Using switches and number ranges

C

cytec123187

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!
 
R

RobG

(e-mail address removed) 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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,534
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top