-
Notifications
You must be signed in to change notification settings - Fork 0
Rule validators
Every rule validator should extend FormValidator::AbstractRuleValidator or one of its subclasses.
-
FormValidator::RuleValidators::Always: An always-pass rule validator. Included mainly for testing purposes. -
FormValidator::RuleValidators::SingleField: A basic validator for rules that involve a single field (e.g., a mandatory field, a field that should be a positive integer...) Takes two parameters:-
field_selector: The specification of a field selector (an instance ofFormValidator::FieldSelectorclass). See FieldSelector for details on its specification. -
value_validators: The specification of an array of field value validators (instances ofFormValidator::AbstractFieldValueValidatorsubclasses). See the page on Field value validators for details on their specification.
Each field selected by the field selector will have its value validated against every value validator.
-
-
FormValidator::RuleValidators::RelatedFields: A basic validator for rules that involve a couple of fields, when the value of a slave field depends on the value of a master field (e.g., if field CC has a value, field Subject must have a value too) Takes four parameters:-
master_field_selector: The specification of a field selector (an instance ofFormValidator::FieldSelectorclass) for the master field. See FieldSelector for details on its specification. -
master_value_conditions: The specification of an array of field value validators (instances ofFormValidator::AbstractFieldValueValidatorsubclasses). See the page on Field value validators for details on their specification. It's optional; if no conditions are met, every master field applies to the slave (usually because the value of the slave is calculated using the master's value). -
slave_field_selector: The specification of a field selector (an instance ofFormValidator::FieldSelectorclass) for the slave field. See FieldSelector for details on its specification. -
slave_value_validators: The specification of an array of field value validators (instances ofFormValidator::AbstractFieldValueValidatorsubclasses). See the page on Field value validators for details on their specification. It's optional, although if no validators are specified, the slave fields just pass.
-