Copy link to clipboard
Copied
Hi All,
I am trying to write an if statement to return a numerical value in a field called "Min" based on the text that is selected in a dropdown box. What I am after is if the dropdown has a value of either KUR1 KUR2 or KUR3 I want the value in the field labelled "Min" to equal 0.5 for anything else I want "Min" to equal 1.0
I did have a long line of if statements written, but I am thinking there must be a much better way of doing it!!!!
Thank you
LC
Copy link to clipboard
Copied
Assuming that this script is in the custom Validate for the dropdown, here is some code:
if((event.value == "KUR1") || (event.value == "KUR2") || (event.value == "KUR3"))
this.getFiel("Min").value = 0.5;
else
this.getFiel("Min").value = 1.0;
Here is another way to perform the same action
switch(event.value)
{
case "KUR1":
case "KUR2":
case "KUR3":
this.getFiel("Min").value = 0.5;
break;
default:
this.getFiel("Min").value = 1.0;
break;
}
Use the Acrobat JavaScript Reference early and often
Copy link to clipboard
Copied
Assuming that this script is in the custom Validate for the dropdown, here is some code:
if((event.value == "KUR1") || (event.value == "KUR2") || (event.value == "KUR3"))
this.getFiel("Min").value = 0.5;
else
this.getFiel("Min").value = 1.0;
Here is another way to perform the same action
switch(event.value)
{
case "KUR1":
case "KUR2":
case "KUR3":
this.getFiel("Min").value = 0.5;
break;
default:
this.getFiel("Min").value = 1.0;
break;
}
Use the Acrobat JavaScript Reference early and often
Copy link to clipboard
Copied
Hi - thanks for the two ideas. Have used the first option and have it working. Thanks for your help.
cheers
LC

