Copy link to clipboard
Copied
On my Form, I have a dropdown with three items in the list, (Option1, Option2, and Option3) that I want to affect two text boxes, Text1 and Text2. Option2 in the dropdown has an Export Value of 200.00, Option3 has an Export Value of 350.00
Option1 is the default selection of the dropdown, and with Option1 I want:
Text1 to be visible and be a regular text field that the user can edit themself, and
Text2 to be hidden and have a value of 0.00
If the user selects Option2, I want:
Text1 to be hidden and have a value of 0.00, and
Text2 to become visible and show the Export Value of Option2 (200.00)
If the user selects Option3, I want:
Text1 to be hidden and have a value of 0.00, and
Text2 to become visible and show the Export Value of Option3 (350.00)
I don't know anything about script writing, I usually just copy-paste scripts that others have posted online, but I haven't found anything yet that meets these requirements. Any help is greatly appreciated, thank you!
Copy link to clipboard
Copied
Since you have export values and if you want to use validation script, then do like this:
var t1 = this.getField("Text1");
var t2 = this.getField("Text2");
if(event.value == "Option1"){
t1.display = display.visible;
t2.display = display.hidden;
t2.value = "";}
else if(event.value == "Option2"){
t1.display = display.hidden;
t1.value = "";
t2.display = display.visible;
t2.value = "200.00";}
else if(event.value == "Option3"){
t1.display = display.hidden;
t1.value = "";
t2.display = display.visible;
t2.value = "350.00";}
Copy link to clipboard
Copied
You'll find the answer here:
https://www.pdfscripting.com/public/Hiding-and-Showing-Form-Fields.cfm
The idea is to use a "Valiation" script on the dropdown so set the visibility
It should have the form.
this.getField('Text2").value = event.value;
if(event.value == "0.00"){//Optionn 1?
this.getField('Text1").display = display.visible;
this.getField('Text2").display = display.hidden;
}
else if(event.value == "200.00"){//Optionn 2
this.getField('Text1").display = display.hidden;
this.getField('Text2").display = display.visible;
}
Copy link to clipboard
Copied
Since you have export values and if you want to use validation script, then do like this:
var t1 = this.getField("Text1");
var t2 = this.getField("Text2");
if(event.value == "Option1"){
t1.display = display.visible;
t2.display = display.hidden;
t2.value = "";}
else if(event.value == "Option2"){
t1.display = display.hidden;
t1.value = "";
t2.display = display.visible;
t2.value = "200.00";}
else if(event.value == "Option3"){
t1.display = display.hidden;
t1.value = "";
t2.display = display.visible;
t2.value = "350.00";}
Copy link to clipboard
Copied
Thank you so much, this worked perfectly!
Copy link to clipboard
Copied
Hi @Shawna_3570,
Hope you are doing well.
Thanks for writing what worked for you, while also marking the statement as correct answer.
This would help future users with similar query use the answer as a reference.
Regards,
Souvik.