This example introduces a technique of using a hidden field. It's often used when we need to treat a few of inputs as one.
For instance, let's assume that we need user to provide one of telephone or cellphone number.
Firstly, we create a hidden field for storing one of these phone numbers.
FormValidation will ask the hidden field to not empty. Because FormValidation ignores hidden fields by default, we need to use the excluded option for our particular field:
The last step, whenever we detect that any of the original phone fields are modified, we update the value for the hidden field and revalidate it:
In this example, we only require either telephone or cellphone numbers by using the notEmpty validator. This approach doesn't solve the problem if we need to apply more validator rules such as the phone number must consist of digits only.
In these cases, you need to use the solutions introduced in the Conditional validation example.