If the element is in fact a group, it will be considered as a whole, an array of group elements' values will be passed to validation function. To validate grouped elements as separate entities, use addGroupRule().
Form element name(s). Currently the only builtin rule that expects and correctly handles an array here is compare:
$form->addElement('password', 'cmpPasswd', 'Password:'); $form->addElement('password', 'cmpRepeat', 'Repeat password:'); $form->addRule(array('cmpPasswd', 'cmpRepeat'), 'The passwords do not match', 'compare', null, 'client'); |
Message to display for invalid data
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) Where to perform validation: "server", "client"
For client-side validation: reset the form element to it's original value if there is an error?
Force the rule to be applied, even if the target form element does not exist
Таблица 42-1. Возможные значения PEAR_Error
Error code | Error message | Reason | Solution |
---|---|---|---|
QUICKFORM_NONEXIST_ELEMENT | Element '$element' does not exist in HTML_QuickForm::addRule() | Tried to add a rule for a non-existant element | Check the element's name spelling or use $force to suppress the error. |
QUICKFORM_INVALID_RULE | Rule '$type' is not registered in HTML_QuickForm::addRule() | Rule is not known to QuickForm | Check rule type spelling or use HTML_QuickForm::registerRule(). |
Пред. | Начало | След. |
Introduction - validation and filters | Уровень выше | HTML_QuickForm::addGroupRule() |
HIVE: All information for read only. Please respect copyright! |