cy*********@gmail.com said on 27/04/2006 8:29 AM AEST:
Hello again,
Now I am trying to create a form within Adobe Acrobat in which a field
(field A) displays a number based on another field (field B). I need
to use ranges of numbers. For instance, whenever field B displays a
number between 0 and 999, field A should display 1. When field B
displays a number between 1000 and 3000, field A should display 2. How
would I go about setting this up using javascript? Thanks in advance
for the help!
cytec123187
P.S. - Thanks for the help with the other problem! I was able to set
up and use the table! Hooray!
You may have under-specified the requirements - guessing that 'between'
means 'inclusive', that the number is an integer and that negative
values indicate an error, then a simple function would be:
function getValue(num)
{
if (num < 0) return null; // Or some error message
if (num < 1000) return 1;
if (num < 3001) return 2;
return null; // Or some error message
// What if num > 3000?
}
Now use some event to set the value of field A:
fieldA.value = getValue(fieldB.value);
Modification is probably required to meet your full requirements.
--
Rob
Group FAQ: <URL:http://www.jibbering.com/FAQ>