you keep moving the goal posts.
put this in your form, to the letter:
$location= New Zend_Form_Element_Select('location');
$location->setLabel('*Location:');
$location->setMultiOptions(array('location1' => 'location1', 'location2' =>
'location2'));
And in your controller:
$data = array('location' => 'location1');
$form = $this->_getTestForm();
$form->populate($data);
does it work? (location1 should be selected)
if yes try this in controller:
$data = array('location' => 'location2');
$form = $this->_getTestForm();
$form->populate($data);
does it still work? (locations2 should now be selected in the select list)
working?
Daniel Latter-2 wrote:
>
> The following is from an earlier post and this is what is throwing the
> error, as you can see there is a reference to $this->data?
>
> foreach($this->data as $loc) <<<<<< is $data passed from controller
> directly accessed here?
> {
> $adlocation->addMultiOption($loc, $loc);
> }
>
>
--
View this message in context:
http://www.nabble.com/Populating-Zend_Form_Element_Select-from-database-example-tp21761696p21765042.html
Sent from the Zend Framework mailing list archive at Nabble.com.