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

Create editable text field populated from dropdown selection

Community Beginner ,
Sep 17, 2018 Sep 17, 2018

Using Adobe Acrobat Pro, I have created a text field that is populated from a a dropdown selection using a simple script (The script is below).
It works great. However, I need to have the text field editable also. Currently, any edits made to the text field revert back to the original text that is populated from the dropdown selection.

Is it possible to have the text field populated based on the dropdown selection and also be editable?

Thanks for any insight.

Sample of script used and working

var v = this.getField("Dropdown1").value; 

if (v=="Selection1") event.value = "Long description for Selection1"; 

else if (v=="Selection2") event.value = "Long description for Selection2"; 

else if (v=="Selection3") event.value = "Long description for Selection3"; 

else event.value = ""; 

TOPICS
PDF forms
976
Translate
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
1 ACCEPTED SOLUTION
Community Expert ,
Sep 17, 2018 Sep 17, 2018

Yeah, there are a couple of ways of doing it. One would be to move the script to be the validation script of the drop-down, instead of the calculation of the text field. You will need to adjust it a bit, though, like this:

var v = event.value;

var f = this.getField("Text1");

if (v=="Selection1") f.value = "Long description for Selection1";

else if (v=="Selection2") f.value = "Long description for Selection2";

else if (v=="Selection3") f.value = "Long description for Selection3";

That way the text field will only be updated when you change the drop-down and you'll be able to edit it manually, if you wished to.

View solution in original post

Translate
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
Community Expert ,
Sep 17, 2018 Sep 17, 2018

Yeah, there are a couple of ways of doing it. One would be to move the script to be the validation script of the drop-down, instead of the calculation of the text field. You will need to adjust it a bit, though, like this:

var v = event.value;

var f = this.getField("Text1");

if (v=="Selection1") f.value = "Long description for Selection1";

else if (v=="Selection2") f.value = "Long description for Selection2";

else if (v=="Selection3") f.value = "Long description for Selection3";

That way the text field will only be updated when you change the drop-down and you'll be able to edit it manually, if you wished to.

Translate
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
Community Beginner ,
Sep 17, 2018 Sep 17, 2018
LATEST

Thanks, I'll give it a try.

Translate
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