Possible Bug in Quickform / Select

From: Date: Thu, 07 Aug 2003 17:27:20 +0000
Subject: Possible Bug in Quickform / Select
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-19383@lists.php.net to get a copy of this message
Hi all, I try to build a ComboBox with a 0 index eg . <select name="select" size="1"> <option value="All" selected>All</option> <option value=0 selected>No</option> <option value=1>Yes</option> </select> If I use the setSelected() Methode like this $selectElement->setSelected("All"); I get the following result <select name="select" size="1"> <option value="All" selected>All</option> <option value=0 selected>No</option> <option value=1>Yes</option> </select> The element with the O index is also selected. After a little investigation, I found at line 486 of Select.php if (is_array($this->_values) && in_array($option['attr']['value'],$this->_values)) { $this->_updateAttrArray($option['attr'],array('selected' => 'selected')); } The in_array() function is called, without the 3rd Parameter (strict) When setting this 3rd Parameter to true if (is_array($this->_values) && in_array($option['attr']['value'],$this->_values,1)) { $this->_updateAttrArray($option['attr'],array('selected' => 'selected')); } The Element with the 0 index is no more selected. Is it a bug or I am missing something ? Thanks a lot for your help, and sorry for my bad English. Pascal

« previous php.pear.dev (#19383) next »