Validating multiple inputs as one

In some cases, you need to validate a value which is combined by various fields. For instance, a Birthday field might be a combination of Date, Month and Year one.

This example show a way to deal with these cases. The following form requires all of Date, Month and Year fields. Also, the combination of them must be a valid date.

First, we need to create a hidden field that its value is generated from Date, Month and Year fields:

We set the validator rules for that hidden field as usual:

Finally, when any of Date, Month and Year fields changes its value, we need to update the hidden field value and revalidate it using the revalidateField() method:

Here is the working example:

More examples

Related validators

The following validators might be useful to you.