Adds a validation rule for the given group of elements
Only groups with a name can be assigned a validation rule. Use addGroupRule() when you need to validate elements inside the group. Also use addRule() if you need to validate the group as a whole.
Form group name
Array for multiple elements or error message string for one element. If this is the array, its structure is the following:
array ( 'element name or index' => array( array(rule data), ... array(rule data) ), ... 'element name or index' => array( array(rule data), ... array(rule data) ) ) |
(optional) Rule type. Use getRegisteredRules() to get types. You can also pass a classname for a descendant of HTML_QuickForm_Rule or an instance of such class.
(optional) Required for extra rule data
(optional) How many valid elements should be in the group
(optional)Where to perform validation: "server", "client"
Client-side: whether to reset the element's value to its original state if validation failed.
Table 31-1. Possible PEAR_Error values
Error code | Error message | Reason | Solution |
---|---|---|---|
QUICKFORM_NONEXIST_ELEMENT | Group '$group' does not exist in HTML_QuickForm::addGroupRule() | Tried to add a rule for a non-existant group | Check the group name spelling |
QUICKFORM_NONEXIST_ELEMENT | Element '$elementIndex' not found in group '$group' in HTML_QuickForm::addGroupRule() | $arg1 is an array and contains an index for an element not present in a group | Check the element index spelling |
QUICKFORM_INVALID_RULE | Rule '$type' is not registered in HTML_QuickForm::addGroupRule() | Rule is not known to QuickForm | Check rule type spelling or use HTML_QuickForm::registerRule(). |
Example 31-1. Using addGroupRule()
|