HTML_QuickForm::addGroupRule()

HTML_QuickForm::addGroupRule()

HTML_QuickForm::addGroupRule() -- Adds a validation rule for the given group

Description

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.

Parameter

string $group

Form group name

mixed $arg1

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)
    )
)
rule data here matches the parameters' order and meaning for addRule() method.

Note: If this parameter is an array, all the subsequent parameters are ignored. You should pass all the modifiers for the rules being added within this array (see the example below).

string $type

(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.

string $format

(optional) Required for extra rule data

integer $howmany

(optional) How many valid elements should be in the group

string $validation

(optional)Where to perform validation: "server", "client"

boolean $reset

Client-side: whether to reset the element's value to its original state if validation failed.

Note

since 2.5

This function can not be called statically.

© Copyright 2003-2023 www.php-editors.com. The ultimate PHP Editor and PHP IDE site.