• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers

Text keeps changing to default when leaving text field

New Here ,
Mar 15, 2019 Mar 15, 2019

Copy link to clipboard

Copied

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!

TOPICS
Acrobat SDK and JavaScript , Windows

Views

124

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Mar 15, 2019 Mar 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";

Likes

Translate

Translate
Community Expert ,
Mar 15, 2019 Mar 15, 2019

Copy link to clipboard

Copied

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";

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 18, 2019 Mar 18, 2019

Copy link to clipboard

Copied

LATEST

Perfect, thanks!

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines