View Full Version : Multiple onChange ranges in Acrobat 6?

01-02-2004, 03:12 PM
I am trying to write a custom script in Acrobat 6 that will set a read-only field to a certain value depending on what a user-entered value in another field is. So, if a user enters a number between 0 and 5, the read-only field becomes, say, -3. If the user enters a number between 6 and 8, the read-only field is something else. Those aren't the actual number ranges, but you get the idea.

This is as far as I have gotten with the initial script, and being new to this, I need some help. This works fine with one range of numbers...

var f = this.getField("second_field");
var x = this.getField("first_field");
if (x.value > 0 && x.value < 5)
f.value = "-3";

...but I need to know how to set this up for multiple number ranges, for instance...

If user enters 1 then second_field becomes -5
If user enters 2 or 3 then second_field becomes -4
If user enters 4 or 5 then second_field becomes -3

...And so on? Do I just add multiple lines of...

if (x.value > ? && x.value < ?)

...and can I use "or" in place of "&&"? I'm totally stuck here... can anyone shine a light on this problem? Thanks...


01-05-2004, 03:38 AM
No takers, eh?