Advanced

Conditional Validation

Validate fields only when certain conditions are met using data-ev-if.

Shipping Details
This field is only validated when Portugal is selected.
This field is only validated when United States is selected.
This field is only validated when the newsletter checkbox is checked.
How It Works

The data-ev-if attribute accepts a condition in the format selector:value. The field is only validated when the target element's value matches.

Syntax
<!-- Validate only if #country = "PT" --> <input data-ev-type="nif" data-ev-required="true" data-ev-if="#country:PT" /> <!-- Validate if checkbox checked --> <input data-ev-type="email" data-ev-if="#newsletter:true" />
Combining Conditions
<!-- AND: both must be true --> data-ev-if="#country:PT&#type:business" <!-- OR: either can be true --> data-ev-if="#country:PT|#country:ES"
Supported Elements
  • Select — matches the selected value
  • Checkbox — use true / false
  • Radio — matches the checked radio's value
  • Input — matches the text value