Quickform and more complex dependent validation
| From: | Tobias Nix | Date: | Tue, 25 Feb 2003 12:14:00 +0000 |
| Subject: | Quickform and more complex dependent validation | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-3946@lists.php.net to get a copy of this message | ||
I have got an HTML Form that similar looks like this:
[FieldKey1] [FieldValue1] [FieldKey2] [FieldValue2] [FieldKeyX] [FieldValueX][Submit] Example code: $field[] =& HTML_QuickForm::createElement('text', 'key1', 'key1'); $field[] =& HTML_QuickForm::createElement('text', 'val1', 'val1'); $form->addGroup($field, 'group1', 'Text Fields1:'); $form->addGroupRule('group1' ,'Fill all fields' ,'required'); $form->addGroupRule('group1' ,'Values must be numeric' ,'numeric'); $field=null; $field[] =& HTML_QuickForm::createElement('text', 'key2', 'key2'); $field[] =& HTML_QuickForm::createElement('text', 'val2', 'val2'); $form->addGroup($field, 'group2', 'Text Fields2:'); $form->addGroupRule('group2' ,'Fill all fields' ,'required'); $form->addGroupRule('group2' ,'Values must be numeric' ,'numeric'); [...] Now I want to add a new Group considering group1, group2, groupx. This group should be valid, if group1 or/and group2 is valid. The form should be valid if: 1. Add something to the KeyX field, also the ValueX field must be field. 2. Key and Value field must be numeric. 3. Only one pair (keyX, valueX) must be filled. Is this possible? Thanks, Tobias.