I have a fillable form which I have a few required fields set.
However there is a main question are you an existing customer yes (tick box) or
are you a new customer (tick box)
then there are fields for each such as name, address, email etc
is there a way to only make required fields relevant if the person selects existing customer then the required fields for new customers can be ignored and vice versa.
Currently if the person selects tick box existing customer then unless they fill out the required fields under the new customer section they cannot submit the form.
You can use JavaScript to set the required property of the fields to true when the Yes check box is selected, and false otherwise. If you tell us what the field names are and the export value of the Yes check box is, we can suggest the specific code you cna use. It would be easiest if you used a hierarchical naming convention for the group of fields. For example, give each a prefix of "req1.' So the field names are: "req1.name", "req1.address", "req1.email", etc. This makes it possible to change the required property of the fields in the group with a single line of code:
// Set all req1 fields to required
getField("req1").required = true;
I want to add that if this radio buttonis already set to required then all this happens:
if(event.target.value ==(1)) {
// selected - show radio buttons
this.getField('NotPresent1').display = display.hidden; // show radio button
} else {
// deselected show hide the radio buttons and reset the field
this.getField('NotPresent1').display = display.visible; // hide radio button
this.resetForm(['NotPresent1']); // clear radio button
}
// Set all S1 fields to required
getField("S1").required = true;
if(event.target.value ==(1)) {
// selected - show radio buttons
this.getField('Normal1').display = display.hidden; // show radio button
} else {
// deselected show hide the radio buttons and reset the field
this.getField('Normal1').display = display.visible; // hide radio button
this.resetForm(['Normal1']); // clear radio button
}
// Set all S1 fields to required
getField("S1").required = false;
And then to remove the requiredness of the radio button.
North America
Europe, Middle East and Africa
Asia Pacific