Hello,

searching on this for hours but can't find the problem.

code
$test[0] = 1;
$test[1] = 2;
$test[2] = 3;
$formElements[] = self::createElement('select', 'test')
        ->setRequired(true)
        ->setLabel('Label')
        ->setMultiOptions($test);

output:
<select name="test" id="test">
    <option value="0" label=""></option>
    <option value="1" label=""></option>
    <option value="2" label="3">3</option>
</select>

So the problem is that I can't use option "1" and "2". if I change it to
e.g. $test[0] = 4 $test[1] = 5 it's going fine... 

everything goes fine until $this->options[$option] = $value. if a do a
var_dump of $this->options just after this the values are wrong. Just before
the $this->options[$option] = $value the $option and $value are still
correct...

    public function addMultiOption($option, $value = '')
    {
        $option  = (string) $option;
        $this->_getMultiOptions();
        if (!$this->_translateOption($option, $value)) {
            $this->options[$option] = $value;
        }
        return $this;
    }

-----
visit my website at  http://www.phpscriptor.com/ http://www.phpscriptor.com/ 
-- 
View this message in context: 
http://www.nabble.com/setMultiOptions-strange-behaviour-tp21708125p21708125.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to