Copy link to clipboard
Copied
I am using a form and I have a radio button set to "hide" all fields if marked off as "No"
However, I am running a script stating that if you choose "yes" all fields have to be filled in.
But even when the "no" is checked, the same fields are requiring to be filled out even though they are hidden.
// iterate over all fields and check the ones that are marked as 'required' var valid = true; for (var i=0; i<this.numFields; i++) { var f = this.getField(this.getNthFieldName(i)); if (f.type != "button" && f.required) { // handle the differnet field types // valid types are button, checkbox, combobox, listbox, radiobutton, signature and text if (f.type == "text") { if (f.value == "") { valid = false; break; } } else if (f.type == "combobox") { // handle the combobox type... } // ... handle all the other types } } if (valid == false) { app.alert("Validation error. Some requried fields are not filled out!"); } else { this.mailDoc(); }
My script is below, how do I add/adjust?
Copy link to clipboard
Copied
When you hide the fields set also the property "required" as false.