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

Conditions too hide or show for fields with Adobe pro DC

Community Beginner ,
Nov 24, 2020 Nov 24, 2020

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   

TOPICS
Create PDFs , PDF forms
2.3K
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
2 ACCEPTED SOLUTIONS
Community Expert ,
Nov 24, 2020 Nov 24, 2020

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.

View solution in original post

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
Community Expert ,
Nov 24, 2020 Nov 24, 2020

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. 

 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

View solution in original post

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
Community Expert ,
Nov 24, 2020 Nov 24, 2020

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.

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
Community Beginner ,
Nov 24, 2020 Nov 24, 2020

Dear Try67,

many thanks for your answer! i will try it and give you a feeback of the results.

 

Best Regards

Noel

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
Community Beginner ,
Nov 24, 2020 Nov 24, 2020

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    

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
Community Expert ,
Nov 24, 2020 Nov 24, 2020

Sorry, I don't quite follow what you mean... What code did you use, and where did you place it?

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
Community Beginner ,
Nov 24, 2020 Nov 24, 2020

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.

 

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
Community Expert ,
Nov 24, 2020 Nov 24, 2020

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. 

 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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
Community Beginner ,
Nov 24, 2020 Nov 24, 2020
LATEST

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 

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