Copy link to clipboard
Copied
I have a form with a drop down menu. If a user selects "OTHER" from the dropdown menu, I want to make a text field required to be filled in before they can submit the form. What is the javascript I would need to run in the dropdown menu action under properties?
Copy link to clipboard
Copied
Use this code as the custom validation script of the drop-down field:
this.getField("Name of text field").required = (event.value=="OTHER");
Copy link to clipboard
Copied
Use this code as the custom validation script of the drop-down field:
this.getField("Name of text field").required = (event.value=="OTHER");
Copy link to clipboard
Copied
Hi. I am trying to do something similar, and keep getting an error on one part. I have a dropdown for "Add" or "Change" with each having different fields that are required depending on what is selected. Everything works OK when "Change" is selected. I'm having the issue with "Add" - I'm guessing that's because more fields are required when choosing "Add". Here is the script I currently have:
this.getField("Vendor ID for changes only").required=(this.getField("Add / Change").valueAsString=="Add");
this.getField("Address").required=(this.getField("Add / Change").valueAsString=="Change");
this.getField("City").required=(this.getField("Add / Change").valueAsString=="Change");
this.getField("State").required=(this.getField("Add / Change").valueAsString=="Change");
this.getField("ZIP").required=(this.getField("Add / Change").valueAsString=="Change");
this.getField("Phone").required=(this.getField("Add / Change").valueAsString=="Change");
this.getField("Contact").required=(this.getField("Add / Change").valueAsString=="Change");
this.getField("Dropdown13").required=(this.getField("Add / Change").valueAsString=="Change");
this.getField("Enter fax # or email address").required=(this.getField("Add / Change").valueAsString=="Change");
Any help you can offer is greatly appreciated!
Copy link to clipboard
Copied
What is the issue, exactly?
Copy link to clipboard
Copied
Thank you!
Copy link to clipboard
Copied
Had same problem. This helped. Thank you.
Copy link to clipboard
Copied
What if another selection on the drop down menu is selected? How can we hide the text field again?

