Copy link to clipboard
Copied
I wanna create a PDF form that has conditional Dropdown list. For example, dropdown list has values: X, Y & Z. If the user chooses “X” he will see a list of checklist different than when he chooses “Y” or “Z”.. so is this possible to do this using adobe pro DC with javascrips ??. thanks..
Here's an example:
var fields1 = ["Field1", "Field2", "Field3"];
var fields2 = ["Field4", "Field5", "Field6"];
for (var i in fields1) this.getField(fields1).display = (event.value=="X") ? display.visible : display.hidden;
for (var i in fields2) this.getField(fields2).display = (event.value=="Y") ? display.visible : display.hidden;
Copy link to clipboard
Copied
I wanna create a PDF form that has conditional Dropdown list. For example, dropdown list has values: X, Y & Z. If the user chooses “X” he will see a list of checklist different than when he chooses “Y” or “Z”.. so is this possible to do this using adobe pro DC with javascrips ??. thanks..
Here's an example:
var fields1 = ["Field1", "Field2", "Field3"];
var fields2 = ["Field4", "Field5", "Field6"];
for (var i in fields1) this.getField(fields1).display = (event.value=="X") ? display.visible : display.hidden;
for (var i in fields2) this.getField(fields2).display = (event.value=="Y") ? display.visible : display.hidden;
Copy link to clipboard
Copied
Do you want to show/hide another field, or do you want to set the items available in a field based on the selection?
Both are possible, but require different approaches.
Copy link to clipboard
Copied
hi, it will be like bellow.
if i select "X" in drop down, bellow that should visible 5 questions & check boxes to select. if i select "Y" in drop down, before 5 questions & check boxes need to disappear & need to visible different 6 questions & check boxes to select in same place. same way i have 5 different drop down selections so same 5 set of questions & check boxes available to hide or display. hope it's clear. thanks..
Copy link to clipboard
Copied
OK. The generic code to do it would be something like this (as the custom validation script of the drop-down field):
if (event.value=="X") {
this.getField("Field1").display = display.visible;
this.getField("Field2").display = display.hidden;
} else if (event.value=="Y") {
this.getField("Field1").display = display.hidden;
this.getField("Field2").display = display.visible;
}
Copy link to clipboard
Copied
hi, thanks for the code. there are lot of items have to add so is that possible to short this code ??
Copy link to clipboard
Copied
It's possible to use an array with the names of the fields to show/hide.
Copy link to clipboard
Copied
can u pls give me some example code ??. thanks...
Copy link to clipboard
Copied
Here's an example:
var fields1 = ["Field1", "Field2", "Field3"];
var fields2 = ["Field4", "Field5", "Field6"];
for (var i in fields1) this.getField(fields1).display = (event.value=="X") ? display.visible : display.hidden;
for (var i in fields2) this.getField(fields2).display = (event.value=="Y") ? display.visible : display.hidden;