Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 3.2.16

Bug #5218 hierselect with third select or more bug
Submitted: 2005-08-27 11:33 UTC
From: naonak at free dot fr Assigned: avb
Status: Closed Package: HTML_QuickForm
PHP Version: Irrelevant OS: xp pro with Firefox
Roadmaps: (Not assigned)    
Comments Add Comment Add patch

Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem : 47 - 45 = ?

 [2005-08-27 11:33 UTC] naonak at free dot fr
Description: ------------ With the 3.2.5 release, hierselect with third select or more keep the lastest select populate do while you not "repopulate" it. See the example. Test script: --------------- <?php require_once 'HTML/QuickForm.php'; $form = new HTML_QuickForm('example'); $select1[0] = 'Pop'; $select1[1] = 'Classical'; $select1[2] = 'Funeral doom'; // second select $select2[2][2] = 'Skepticism'; // Create a third select with prices for the cds $select3[2][2][1] = '17.00$'; // Create the Element $sel =& $form->addElement('hierselect', 'cds', 'Choose CD:'); // And add the selection options $sel->setOptions(array($select1, $select2, $select3)); $form->display(); ?>


 [2005-08-30 10:34 UTC] avb
This behaviour appears only because you didn't set options for all possible values in previous selects. Probably it should be documented that second and subsequent selects should contain options corresponding to all possible values of previous selects.
 [2005-08-30 10:56 UTC] naonak at free dot fr
It is not normal behavior in me mind and if that is, it is stupid behavior! It's BUG because not in the other release!
 [2005-08-31 08:15 UTC] avb
Yes it did (somewhat) work in the older release, but it was never *designed* that way. Please also consider the following: HTML standard does not allow <select> tags without at least one option.
 [2005-09-05 12:42 UTC] naonak at free dot fr
"HTML standard does not allow <select> tags without at least one option." => If select is empty, let an option to not generate it in this case. What do you thing about this?
 [2006-06-18 11:19 UTC] avb (Alexey Borzov)
Documented the need to have keys for all previous elements in subsequent elements' options.