Form - Required field depends on another field

Joel Dahlin asked on June 3, 2014 12:45

I have a Contact form that I have created. I have a zipcode field that when they enter it I do a lookup on that zipcode to determine if another field should be displayed or not. I am taking advantage of the "Has depending fields", "Depends on another field" field properties. This is working great. Now, I want to make that field that depends on another field required only when visible. If I set the field to be required it doesn't pass validation if nothing is populated even though the field isn't visible.

Is it possible to achieve this using the built-in form fields or am I going to have to create a custom form control?

Correct Answer

Jan Hermann answered on June 4, 2014 04:30


please mark that field to not be required and then set the validation regular expression to some expression to fit your needs. For simple required field you can use .+ since the field gets validated only if it's visible.

Best regards, Jan Hermann

1 votesVote for this answer Unmark Correct answer

   Please, sign in to be able to submit a new answer.