Re: Possible Bug in Quickform / Select
| From: | Bertrand Mansion | Date: | Thu, 07 Aug 2003 17:55:20 +0000 |
| Subject: | Re: Possible Bug in Quickform / Select | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-19385@lists.php.net to get a copy of this message | ||
<pascalthuet@altern.org> wrote :
> 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 ?
I don't think that's the problem.
Could you be more precise about when this happens ?
Even better, could you send a piece of code that can reproduce this bug.
Thanks,
Bertrand Mansion
Mamasam