Home » HTML » HTML_QuickForm » Bug #2571
Multilevel hierselect single-element-list bug
Details
| Submitted | 2004-10-19 22:28 UTC |
|---|---|
| From | support at infinity dot com dot ua |
| Assigned | avb |
| Status | Closed |
| Package | HTML_QuickForm |
| PHP Version | 5.0.2 |
| OS | Irrelevant |
| Roadmaps | (Not assigned) |
Comments
[2004-10-19 22:28 UTC] support at infinity dot com dot ua
Description:
------------
Version 3.2.4
Bug occurs with three-or-more-level hierselect element.
Let's say we have 3 level menu (see sources below).
First level contains two element - 'Irrelevant' and 'One'.
The second and the third levels of 'Irrelevant' each have the single 'Irrelevant' element. So the first entry is just three-level dummy.
The 'One' element contains only one element ('One_One') on the second level, and 'One_One' contains three elements - 'One_One_One', 'One_One_Two' and 'One_One_Three'.
When the page rendered, all three levels are populated with 'Irrelevant' element. But when I click on 'One' in the first level, only second level gets populated. Because second level consists of only one element ('One_One'), there's no way I can trigger onChange event, so the third level never get's populated!
Furthermore, if after this I click back to 'Irrelevant' at first level, again, only the second level get's pipulated, leaving third level empty.
Sorry for my poor description, but this case is quite complicated to explain. I hope sources below will help more.
Reproduce code:
---------------
require_once 'HTML/QuickForm.php';
$first = array
(
'Irrelevant',
'One',
);
$second = array
(
array('Irrelevant'),
array
(
'One_One'
),
);
$third = array
(
array(array('Irrelevant')),
array
(
array
(
'One_One_One',
'One_One_Two'
),
),
);
$form = new HTML_QuickForm('form', 'post');
$sel = $form->addElement('hierselect', 'test', 'Test');
$sel->setOptions(array($first, $second, $third));
$form->display();
Expected result:
----------------
Proper (recursive?) automatic population of all levels in multilevel menu after onChange() event.
Actual result:
--------------
If the second level contains only one element, third and further levels never get populated.