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

Drop Down List IF/THEN Visible or Hidden Date

New Here ,
Jun 04, 2021 Jun 04, 2021

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
1.5K
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
3 ACCEPTED SOLUTIONS
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.

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

You uses spaces before P and F.

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

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

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.

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

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 🙂

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

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.

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

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

Dropdown 2.PNG

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

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

You uses spaces before P and F.

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

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,

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

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

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

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

Wow, worked like a charm!  Thank you 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