Copy link to clipboard
Copied
Hello, so I am new to Acrobat and I have figured out how to do this with checkboxes, but I am trying to do it with a drop-down menu.
Ex:
You have drop menu called Drop1. in Drop1 you have item1, item2, item3.
If user select item1, a hidden pop-up box will appear on Screen saying "You have selected Item 1".
If user select item2, a hidden pop-up box will appear on Screen saying "You have selected Item 2".
ect.
This is almost exactly what I need, except with a drop-down menu.
Acrobat XI Tutorial Showing Form Fields Based on a Checkbox - YouTube
I do know c++ programming, so I know a little bit about programming, but I believe this is java.
Copy link to clipboard
Copied
It's pretty much the same, just access the valueAsString property of the field to get the currently selected value.
Copy link to clipboard
Copied
okay so I’m not very familiar with Java, could i possible get the code for that.
Ex: you have Drop1, and Text1. In Drop1 you have options 1,2,3. I only want Text1 showing up when 2 and or 3 are selected.
the Only thing confusing to me is how I’m accessing those Value Making it appear or disappear based on the selection
Copy link to clipboard
Copied
First of all, it's JavaScript, not Java.
OK, to do that you can use the following code as the custom validation script of "Drop1":
var showField = (event.value=="2" || event.value=="3");
this.getField("Text1").display = showField ? display.visible : display.hidden;
The second line is a form of if-condition, and can be replaced by this:
if (showField==true) {
this.getField("Text1").display = display.visible;
} else {
this.getField("Text1").display = display.hidden;
}
Make sure to tick the option to commit the selected value of the drop-down field immediately if you want it to work as soon as you make the selection (under the field's Properties, Options tab).
Copy link to clipboard
Copied
Yeah my bad, I just realized I was saying java. Okay cool, I’ll give that a shot in the morning! Thank you.
just to clarify, the second line for the if state, its just stating if true, display message, else hide message. correct?
Copy link to clipboard
Copied
If by "message" you mean field, then yes.