Conditional Field Validation
When a field is hidden by conditional logic, Formcierge automatically skips its validation. But you can also use the formcierge_validate_field filter to add server-side validation rules that depend on other field values.
If a field is hidden by a condition rule, its value is not required — even if you've checked "Required" in the field settings. Formcierge strips validation for hidden fields automatically, both client-side and server-side.
Use the formcierge_validate_field filter to write validation that depends on another field's value. The filter fires for each field during submission processing.
The filter should return a non-empty string to block submission with that string as the error message, or $error (the original value, usually empty) to let it pass. The error is displayed inline beneath the field.
Client-side conditional logic improves UX; server-side validation ensures data integrity. Always implement both for fields that depend on submitted values from other fields.