Dynamic Default Value selection in Zend_Form_Eleme

2019-09-01 03:58发布

问题:

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?