QuickForm and Group Rules Again :)
| From: | xavier | Date: | Thu, 20 Nov 2003 18:29:48 +0000 |
| Subject: | QuickForm and Group Rules Again :) | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-9072@lists.php.net to get a copy of this message | ||
Hi list,
i'm trying to use efficiently QuickForm, but i'got a trouble :)
let's say i have a quickform like this:
$form = new HTML_QuickForm();
$group[] =& HTML_QuickForm::createElement('text', 'city');
$group[] =& HTML_QuickForm::createElement('text', 'state');
$group[] =& HTML_QuickForm::createElement('text', 'zip');
$form->addGroup($group, 'city_state_zip', 'City, State, Zip:');
$form->addElement('submit', 'submit');
$address_rules['city'][0] = array('City is required', 'required');
$address_rules['state'][0] = array('State is required.', 'required');
$address_rules['zip'][0] = array('Zip Code is required', 'required');
$form->addGroupRule('city_state_zip', $address_rules);
this is one of quickform examples.
if i use $form->toArray()
i will detect rules and errors on a per group basis.
Is there a way to mark the child element of a group with is own error ?
for now, if the form is not valid i got:
[elements] => Array
(
[0] => Array
(
[name] => city_state_zip
[value] => Array
(
[city] => rrr
[state] =>
[zip] =>
)
[type] => group
[frozen] =>
[label] => City, State, Zip:
[required] => 1
[error] => State is required.
[separator] =>
[elements] => Array
(
[0] => Array
(
[name] => city_state_zip[city]
[value] => rrr
[type] => text
[frozen] =>
[label] =>
[required] =>
[error] =>
^^^^^^^^^^^^^^^^^^
[html] =>
)
And i would like:
[elements] => Array
(
[0] => Array
(
[name] => city_state_zip
[value] => Array
(
[city] =>
[state] =>
[zip] =>
)
[type] => group
[frozen] =>
[label] => City, State, Zip:
[required] => 1
[error] => city is required.
[separator] =>
[elements] => Array
(
[0] => Array
(
[name] => city_state_zip[city]
[value] =>
[type] => text
[frozen] =>
[label] =>
[required] =>
[error] => city is required
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[html] =>
)
Thanks for your replies
Regards
Xavier