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.
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.
You uses spaces before P and F.
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...
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.
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 🙂
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.
Copy link to clipboard
Copied
Done and done sir :). Still no change though, it will only disappear not reappear.
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.
Copy link to clipboard
Copied
You uses spaces before P and F.
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,
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?
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...
Copy link to clipboard
Copied
Wow, worked like a charm! Thank you again 🙂