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

How to activate field based on choice of dropdown?

New Here ,
Jun 05, 2016 Jun 05, 2016

Hello people,

Hope you could help me out with the following:


I have a pdf document that consist of a dropdown menu (with 3 choices) and a textfield that should only be activated if 1 choice(lets call it "amendment") has been selected in the dropdown menu.


If that particular choice ("amendment") has been changed to another option; then the textfield should be deactivated again.

Anyone knows how to arrange this? I am trying to figure this out for ages.

TOPICS
Acrobat SDK and JavaScript
284
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
Participant ,
Jun 06, 2016 Jun 06, 2016
LATEST

I think I know what you're asking for.

You can place this into the Actions tab in your dropdown properties.

On Blur>Run A JavaScript;

var fldText1 = this.getField("Textfield");

var fldDropdown = this.getField("Dropdown").value;

if (fldDropdown == "Amendment") { //If dropdown selection is "Amendment" option

     fldText1.display = display.visible; //Sets the text field to visible

}

else { //if anything but "Amendment"

     fldText1.display = display.hidden; //Sets the text field to hidden

}

You can also set the value to read only as well if you don't wish the field to be hidden yet still be unable to be edited.

var fldText1 = this.getField("Textfield");

var fldDropdown = this.getField("Dropdown").value;

if (fldDropdown == "Amendment") { //If dropdown selection is "Amendment" option

     fldText1.readonly = false; //Sets the text field to editable

}

else { //if anything but "Amendment"

     fldText1.readonly = true; //Sets the text field to readonly

}

If you set the text field to Read Only by default in its properties you should be good to go with that.

Hope this answers your question.

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