Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


Drop Down List IF/THEN Visible or Hidden Date

New Here ,
Jun 04, 2021 Jun 04, 2021

Copy link to clipboard

Copied

Hi there everyone,
I'm trying to make it so when the user selcts P or F from the droplist on the right that the date of inspection will be displayed on the left, but IF they select N/A I want the date not visible.  Can anyone help me figure this out?  Thank you in advance for all your help.

 

Dropdown 1.PNG

TOPICS
Edit and convert PDFs, General troubleshooting, JavaScript, PDF forms

Views

411

Likes

Translate

Translate

Report

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

correct answers 3 Correct answers

Adobe Community Professional , Jun 04, 2021 Jun 04, 2021
The values are not what you said. There are space before them. You have to use EXACTLY the same value in the code as you did in this dialog.

Likes

Translate

Translate
Adobe Community Professional , Jun 04, 2021 Jun 04, 2021
You uses spaces before P and F.

Likes

Translate

Translate
Adobe Community Professional , Jun 04, 2021 Jun 04, 2021
Change this part of the code: (this.getField("Dropdown1").valueAsString=="N/A") To: (this.getField("Dropdown1").valueAsString=="N/A" || this.getField("Dropdown1").valueAsString=="F") Don't forget to add the spaces, though...

Likes

Translate

Translate
Adobe Community Professional ,
Jun 04, 2021 Jun 04, 2021

Copy link to clipboard

Copied

As the custom calculation script of the date field enter something like this:

 

event.target.display = (this.getField("Dropdown1").valueAsString=="N/A") ? display.hidden : display.visible;

 

Replace "Dropdown1" with the actual field name, of course.

Likes

Translate

Translate

Report

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
New Here ,
Jun 04, 2021 Jun 04, 2021

Copy link to clipboard

Copied

Thank you so much!  I just did it and it seems on the right track.  When I choose N/A now the date disapperas, which is perfect, however if I then change the option back to the P or F, the date stays hidden and it does not reappear.  Is there any way to fix that?

 

Thank you again for your exertse 🙂

Likes

Translate

Translate

Report

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
Adobe Community Professional ,
Jun 04, 2021 Jun 04, 2021

Copy link to clipboard

Copied

It should happen automatically. Make sure to set the option to commit the selected value immediately, under the Properties of the drop-down field, in the Options tab.

Likes

Translate

Translate

Report

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
New Here ,
Jun 04, 2021 Jun 04, 2021

Copy link to clipboard

Copied

Done and done sir :).  Still no change though, it will only disappear not reappear.  

Dropdown 2.PNG

Likes

Translate

Translate

Report

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
Adobe Community Professional ,
Jun 04, 2021 Jun 04, 2021

Copy link to clipboard

Copied

The values are not what you said. There are space before them. You have to use EXACTLY the same value in the code as you did in this dialog.

Likes

Translate

Translate

Report

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
Adobe Community Professional ,
Jun 04, 2021 Jun 04, 2021

Copy link to clipboard

Copied

You uses spaces before P and F.

Likes

Translate

Translate

Report

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
New Here ,
Jun 04, 2021 Jun 04, 2021

Copy link to clipboard

Copied

You were totally right, I added the spaces into the script and now it works like a charm.  Thank you to both of you for helpong me with this.

 

Thank you again,

Likes

Translate

Translate

Report

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
New Here ,
Jun 04, 2021 Jun 04, 2021

Copy link to clipboard

Copied

If I wanted the script to also hide the date if the user selected F OR N/A, how could I do that?

Likes

Translate

Translate

Report

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
Adobe Community Professional ,
Jun 04, 2021 Jun 04, 2021

Copy link to clipboard

Copied

Change this part of the code:

(this.getField("Dropdown1").valueAsString=="N/A")

To:

(this.getField("Dropdown1").valueAsString=="N/A" || this.getField("Dropdown1").valueAsString=="F")

Don't forget to add the spaces, though...

Likes

Translate

Translate

Report

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
New Here ,
Jun 04, 2021 Jun 04, 2021

Copy link to clipboard

Copied

LATEST

Wow, worked like a charm!  Thank you again 🙂

Likes

Translate

Translate

Report

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