Skip to main content
keithr99387369
Participating Frequently
March 8, 2023
Answered

Make a Dropdown Menu Field unfillable if text entered in specific field

  • March 8, 2023
  • 1 reply
  • 1675 views

Hi All

What I am trying to achieve is, if you refer to the attached PDF - look at the only 2 populated fields and what I I want is if some enters any text for the Install Height then it shhould not allow them to choose from the dropdown menu in Loop Size. So any text entered in Install Height disables Loop Size. I have tried but as soon as I click Install Height then Loop Size disappears but it does not return if I do not enter any Install Height information.

There would be a further 10 rows of these so I presume I would have to rename then Loop Size1, Loop Size 2 for each row.

Thanks in advance.

This topic has been closed for replies.
Correct answer Nesa Nurani

Remove the scripts you have and as custom calculation script of one of the fields, use this:

for(var i=1; i<=11; i++){
if(this.getField("Install Height "+i).valueAsString == "")
this.getField("Loop Size "+i).display = display.visible;
else
this.getField("Loop Size "+i).display = display.hidden;}

11 represents 11 rows you have, so when you add all 11 rows, the script will work.

 Here is your file with added 3 fields to test:

https://drive.google.com/file/d/1YOd8w6BXzhZOmO8bOj53DfBvKR22695I/view?usp=share_link 

1 reply

Nesa Nurani
Community Expert
Nesa NuraniCommunity ExpertCorrect answer
Community Expert
March 8, 2023

Remove the scripts you have and as custom calculation script of one of the fields, use this:

for(var i=1; i<=11; i++){
if(this.getField("Install Height "+i).valueAsString == "")
this.getField("Loop Size "+i).display = display.visible;
else
this.getField("Loop Size "+i).display = display.hidden;}

11 represents 11 rows you have, so when you add all 11 rows, the script will work.

 Here is your file with added 3 fields to test:

https://drive.google.com/file/d/1YOd8w6BXzhZOmO8bOj53DfBvKR22695I/view?usp=share_link 

keithr99387369
Participating Frequently
March 8, 2023

Wow - thanks so much for the response - very much appreciated. So when the rest of the form is populated do I have to rename each row 1 to 11 (or it normally autofills other rows). Thanks again.

Nesa Nurani
Community Expert
Community Expert
March 8, 2023

That script will work on all rows as long as you name your fields correctly, "Install Height 1-11" and same for "Loop Size".