Home » HTML » HTML_QuickForm » Bug #10139
Hierselect doesn't show subselect values.
Details
| Submitted | 2007-02-20 18:53 UTC |
|---|---|
| From | vigoncas at eui dot upv dot es |
| Assigned | avb |
| Status | Wont fix |
| Package | HTML_QuickForm |
| PHP Version | 5.2.1 |
| OS | Linux Debian Sarge |
| Roadmaps | (Not assigned) |
Comments
[2007-02-20 18:53 UTC] vigoncas at eui dot upv dot es
Description:
------------
Hierselect doesn't show subselect values.
In the test script the city select component only shows values when you change the country component one time at least.
I have compared the HTML result between 3.2.5 and 3.2.7 package versions and the result is that in 3.2.7 we obtain this javascript line:
_hs_defaults['city'] = [1, []];
and in 3.2.5 we obtain this
_hs_defaults['city'] = [3, 1];
Test script:
---------------
$countryArray = array('1'=>'France', '2'=>'Italy');
$cityArray = array(
'1' => array('1'=>'Paris', '8019'=>'Toulouse'),
'2' => array('23'=>'Pisa', '2349'=>'Rome'),
);
$city =& $form->addElement('hierselect','city','city');
$options = array($countryArray, $cityArray);
$city->setOptions($options);
[2007-02-21 08:55 UTC] vigoncas at eui dot upv dot es
The code in a environment with PHP 5.2.1, HTML_QuickForm 3.2.7 and Apache 2.0.54 works badly and generates this wrong code when we don't have an initial value selected:
_hs_options['city'] = [
{ '1': { '1': 'Paris', '8019': 'Toulouse' }, '2': { '23': 'Pisa', '2349': 'Rome' } }
];
_hs_defaults['city'] = [1, []];
//]]>
</script><select name="city[0]" onchange="_hs_swapOptions(this.form, 'city', 0);">
<option value="1">France</option>
<option value="2">Italy</option>
</select> <select name="city[1]">
</select>
--------------------------------------------
The same code in a environment with PHP 5.2.0, HTML_QuickForm 3.2.7 and Apache 1.3.33 works perfectly and generates this correct code when we have Paris as initial value selected:
_hs_options['city'] = [
{ '1': { '1': 'Paris', '8019': 'Toulouse' }, '2': { '23': 'Pisa', '2349': 'Rome' } }
];
_hs_defaults['city'] = [1, 1];
//]]>
</script><select name="city[0]" onchange="_hs_swapOptions(this.form, 'city', 0);">
<option value="1">France</option>
<option value="2">Italy</option>
</select> <select name="city[1]">
<option value="1">Paris</option>
<option value="8019">Toulouse</option>
</select>
-----------------------------------
In all the HTML generated by environments that is the unique difference.
Some idea?
[2007-02-21 09:01 UTC] vigoncas at eui dot upv dot es
In the last comment, when I said '...when we don't have...' I wanted to say '...where we don't have...' and when I said '...when we have...' I wanted to say '...where we have...'.