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

Bug #3193 Frozen select boxes display incorrect values
Submitted: 2005-01-13 22:18 UTC
From: justinpatrin Assigned: avb
Status: Closed Package: HTML_QuickForm
PHP Version: 4.3.10 OS: Linux
Roadmaps: (Not assigned)    
Subscription  
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:
MUST BE VALID
Solve the problem : 34 + 2 = ?

 
 [2005-01-13 22:18 UTC] justinpatrin
Description: ------------ When creating a select with strings as keys and adding an entry with a key of 0, the 0 option is always shown when the select field is frozen. This can be fixed by changing this line in select.php in getFrozenHtml(): if ($val == $this->_options[$i]['attr']['value']) { to: if ((string)$val == (string)$this->_options[$i]['attr']['value']) { Reproduce code: --------------- Reproduce code is here: http://www.reversefold.com/PEAR/frozenSelect.php Expected result: ---------------- Should be ab Select with 'ab' selected Should be ab ab Actual result: -------------- Should be ab Select with 'ab' selected Should be ab Zero

Comments

 [2005-01-14 21:07 UTC] avb
Looks like such a change was made to toHtml() method in revision 1.22, but getFrozenHtml() was not touched for some reason... They should behave consistently of course.
 [2005-06-18 20:59 UTC] avb
This bug has been fixed in CVS. In case this was a documentation problem, the fix will show up at the end of next Sunday (CET) on pear.php.net. In case this was a pear.php.net website problem, the change will show up on the website in short time. Thank you for the report, and for helping us make PEAR better.
 [2007-02-28 21:02 UTC] neyroberto at gmail dot com (Ney Roberto)
Hi folks, I made a change in select.php in getFrozenHtml method for display value. Check out: //for ($i = 0, $optCount = count($this->_options); $i < $optCount; $i++) { // if ((string)$val == (string)$this->_options[$i]['attr']['value']) { // $value[$key] = $this->_options[$i]['text']; // break; // } //} if (is_array($this->_options)) { foreach ($this->_options as $optionvalue => $optionkey) { if ((string)$val == (string)$optionkey['attr']['value']) { $value[$key] = $optionvalue; } } }