Skip to main content
Ernesto22
Participant
March 15, 2019
Answered

Text keeps changing to default when leaving text field

  • March 15, 2019
  • 2 replies
  • 612 views

I have a drop down menu in a PDF  called "selectedReg" that changes a text field.

I have the following in the Custom calculation script for the text field:

if (selectedReg=="1") event.value = "Text for option 1";

else if (selectedReg=="2") event.value = "Text for option 2";

else if (selectedReg=="3") event.value = "Text for option 3";

After the text is displayed, I need to add some additional text to it.  But when I click out of the text field it will keep reverting to the default value.

Any easy way that I can make changes to the text field and make them stay?

Thanks!

This topic is closed to new replies. Start a new post to keep the conversation going.
Correct answer try67

You need to move the code to the custom validation script of the drop-down and change it to this:

var f = this.getField("name of text field");

if (event.value=="1") f.value = "Text for option 1";

else if (event.value=="2") f.value = "Text for option 2";

else if (event.value=="3") f.value = "Text for option 3";

2 replies

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
March 15, 2019

You need to move the code to the custom validation script of the drop-down and change it to this:

var f = this.getField("name of text field");

if (event.value=="1") f.value = "Text for option 1";

else if (event.value=="2") f.value = "Text for option 2";

else if (event.value=="3") f.value = "Text for option 3";

Ernesto22
Ernesto22Author
Participant
March 18, 2019

Perfect, thanks!