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

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

901

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

Community Expert , 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.

Votes

Translate

Translate
Community Expert , Jun 04, 2021 Jun 04, 2021

You uses spaces before P and F.

Votes

Translate

Translate
Community Expert , 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...

Votes

Translate

Translate
Community Expert ,
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.

Votes

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 🙂

Votes

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
Community Expert ,
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.

Votes

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

Votes

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
Community Expert ,
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.

Votes

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

Copy link to clipboard

Copied

You uses spaces before P and F.

Votes

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,

Votes

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?

Votes

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
Community Expert ,
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...

Votes

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 🙂

Votes

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