#25360 [Opn->Asn]: hierselect failed in the validate
| From: | arnaud@php.net | Date: | Tue, 02 Sep 2003 14:04:42 +0000 |
| Subject: | #25360 [Opn->Asn]: hierselect failed in the validate | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-20991@lists.php.net to get a copy of this message | ||
ID: 25360
Updated by: arnaud@php.net
Reported By: cristianoarnold at yahoo dot com dot br
-Status: Open
+Status: Assigned
Bug Type: PEAR related
Operating System: Windows 2000
PHP Version: Irrelevant
-Assigned To:
+Assigned To: mamasam
Previous Comments:
------------------------------------------------------------------------
[2003-09-02 08:13:01] cristianoarnold at yahoo dot com dot br
Description:
------------
When I have a first select option that don't have second select option,
then the rule failed to validate and submit the form values to
process.
Example
When I select 'Argentina' (below), that don't have second options
(because still he was not inserted in the database) then the hierselect
load the second select empty, then I submit the form and the validate
failed and process the form.
Reproduce code:
---------------
$main[0] = "Brasil";
$main[1] = "Argentina";
$secondary[0][0] = "Porto Alegre";
$secondary[0][1] = "Rio de Janeiro";
$form->setDefaults(array('location'=>array(0,1)));
$sel =& $form->addElement('hierselect', 'location',
'Location:');
$sel->setMainOptions($main);
$sel->setSecOptions($secondary);
$form->addElement('submit', 'btnSubmit', 'Submit');
$form->addRule('location', 'Field Required', 'required');
if ($form->validate())
$form->process($function = 'insert', false);
$form->display();
Expected result:
----------------
I expect that the rule break and return the message 'Field Required' to
second element location too
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=25360&edit=1