Copy link to clipboard
Copied
Dear Community,
i've tried to configure a Dropdown Menu for a example Car, Bike, House. If i selecet Car, in the next Textfield should House buy date hide and instead of that should Car brand/ model shows. I use Adobe pro DC and i can't find the conditions settings. Many thanks for your support and answers.
Best Regards
Noel
Copy link to clipboard
Copied
As the custom validation script of your drop-down field use something like this:
this.getField("House buy date").display = (event.value=="House") ? display.visible : display.hidden;
You can duplicate that line and adjust the field name and values as needed.
Note that this code does not reset the fields when hiding them, though, so if you want to make sure that that field is also empty when not shown then you'll need to use additional code to do it.
Copy link to clipboard
Copied
Here is an article on hiding and showing fields:
https://www.pdfscripting.com/public/Hiding-and-Showing-Form-Fields.cfm
The delayed selection response you are seeing is because the dropdown value is not being committed immediately. So the validation script isn't run until you exit the field. Fortunately there is a setting for this. Look on the option tab in the dropdown properties dialog. Select the "Commit selection immediately" option.
Copy link to clipboard
Copied
As the custom validation script of your drop-down field use something like this:
this.getField("House buy date").display = (event.value=="House") ? display.visible : display.hidden;
You can duplicate that line and adjust the field name and values as needed.
Note that this code does not reset the fields when hiding them, though, so if you want to make sure that that field is also empty when not shown then you'll need to use additional code to do it.
Copy link to clipboard
Copied
Dear Try67,
many thanks for your answer! i will try it and give you a feeback of the results.
Best Regards
Noel
Copy link to clipboard
Copied
Dear try67,
great it works fine many thanks! I've a last question, if i selected House or Car, the fields are not automatically hidden or visible after making somewhere a second click, is the false textfield hidden and the true textfield visible. Many thanks.
Best Regards
Noel
Copy link to clipboard
Copied
Sorry, I don't quite follow what you mean... What code did you use, and where did you place it?
Copy link to clipboard
Copied
I've one dropdown Menu with two values (House, Car) and two textfields. The textfields are on top of each other. For example:
Dropdownmenu (House, Car)
"Textfield1 House buy date" and "Textfield2 Car brand/model" on top of each other
I used this code in Dropdown as validation script:
this.getField("House buy date").display = (event.value=="House") ? display.visible : display.hidden;
this.getField("Car brand/model").display = (event.value=="Car") ? display.visible : display.hidden;
So if i test it and select from the Dropdownmenu the value "House", the textfield aren't change after selecting "House" i have/ want to click once again on somewhere, after clicking, the textfield changed to "House buy date". I want after selecting a value from the dropdownmenu "House", that the textfield changed to the true Text "House buy date" without click once again.
Copy link to clipboard
Copied
Here is an article on hiding and showing fields:
https://www.pdfscripting.com/public/Hiding-and-Showing-Form-Fields.cfm
The delayed selection response you are seeing is because the dropdown value is not being committed immediately. So the validation script isn't run until you exit the field. Fortunately there is a setting for this. Look on the option tab in the dropdown properties dialog. Select the "Commit selection immediately" option.
Copy link to clipboard
Copied
Dear Thom Parker,
many thanks for your great answer! Now after selecting a value from the Dropdownmenu the textfields changed immediately!
Many thanks too all
Best Regards
Noel
Find more inspiration, events, and resources on the new Adobe Community
Explore Now