Skip to main content
michaelg53080893
Participant
June 5, 2016
Question

How to activate field based on choice of dropdown?

  • June 5, 2016
  • 1 reply
  • 327 views

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.

This topic has been closed for replies.

1 reply

Inspiring
June 6, 2016

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.