Toggle menu

Make a Field Required using Validation Functions

You can compare the value of one field to another to dynamically change the validation of a field.

In this example, each input field checks what was picked from the radio group, then if the input is empty, returns invalid.

The phone number and email input boxes each have validation functions that look like this:

Phone Validation Function

Validation Function
 

Email Validation Function

Email Validation Function
 

Pick an option from the radio buttons then press submit. The input fields become "required" based on what you choose.

Share this page

Facebook icon Twitter icon email icon

Print

print icon