shoudnt $adlocation be $location?

Thank You
Daniel Latter



2009/1/31 Deepak Shrestha <[email protected]>:
> sorry! Reply in gmail sent the private message instead of mailing
> list. so I am posting again to the list
>
> ---------------------------------------
>> This might help,
>> http://peacocksuit.com/blog/2008/08/30/populate-a-zend_form-select-with-mysql-returned-data/
>>
>
> I had a look at it but still confused.
>
> 1. Isn't that form should not manipulate data directly from table?
> 2. Besides that I want to know how $form->populate($data) works in
> zend framework's ideal condition.
>
> ===================
>
> OK to the point.
>
> in my controller, I have
> ==================
> $data = array('rat', 'cat');
> $form    = $this->_getTestForm();
> $form->populate($data);
> ...
> ....
> ==================
>
> in my form, I have
> ===========================================
> $location = New Zend_Form_Element_Select('adlocation');
> $location->setLabel('*Location:');
> foreach($this->data as $loc)    <<<<<< is $data passed from controller
> directly accessed here?
> {
>  $adlocation->addMultiOption($loc, $loc);
> }
> ...
> ...
> ===========================================
>
> Now when form renders, Select doesn't get populated.
>
> What is wrong with this code? plus how to make it work?
>

Reply via email to