Dynamic Default Value selection in Zend_Form_Eleme

2019-09-01 04:04发布

In a zend form, I have a multiple select box defined, with just setup.

    $test= $this -> createElement("multiselect", 'test');
    $test-> setLabel("test");

Later on its values will be added from controller.

    $results = array(.....);
    $test= $form -> getElement('test');     
    $test-> setMultiOptions($results)
        -> setValue(array_keys($results));

The new values are updated to the form, but the setValue part is not working, thus no default value is selected.

What am i doing wrong, and how to sove this?

0条回答
登录 后发表回答