Copy link to clipboard
Copied
Working with Adobe Acrobat Pro DC
I am trying to fill two other text fields with different information depending on what is entered into a third text field. Here is the script I put together, but it is not working. I have tried to set it to Select Trigger: Mouse Up and Mouse Enter also. Any suggestions?
var v = event.target.value;
var f4 = this.getField("Days available");
var f5 = this.getField("Pay Level");
if (v != "1") {
f4.value = "3";
f5.value = "1";
}
else if (v != "2") {
f4.value = "4";
f5.value = "1";
}
else if (v != "3") {
f4.value = "5";
f5.value = "2";
}
else if (v != "4") {
f4.value = "6";
f5.value = "3";
What exactly is happening when you enter a value?
Did you check the Acrobat JavaScript console for any errors?
What do you want to happen if none of the expected values is entered?
I would consider using the equality operator and not the no equal operator.
Copy link to clipboard
Copied
What exactly is happening when you enter a value?
Did you check the Acrobat JavaScript console for any errors?
What do you want to happen if none of the expected values is entered?
I would consider using the equality operator and not the no equal operator.
Copy link to clipboard
Copied
Sorry, I am very new to writing scripts. As soon as I select the text field it puts 3 and 1 in the other fields. If I enter another number then nothing happens.
Where do I find the JavaScript console?
Sorry I had added the following at the end for when there was something else put in the field and forgot to put that in original post.
else {
f4.value = "0";
f5.value = "0";
}
Thank you for pointing out the no equal operator. That appears to have been my problem, thank you very much for your help for such a silly problem.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now