> It looks like your doing it correct except for the array of data that you're
> using to populate the form. You're not actually populating the select
> element with options, you only want the current Or selected option to be
> selected in the select list on display.
>
> So in your case it's probably a location id,
>
> $data = array(
>    'location_id' => 2
> );
> $form->populate($data);
>
> Change location_id to whatever the id of the select element is.
>
>

Ok, just help me in this part

As I mention i my first post, I have table called location with field
"locname" as only field and also the primary key for that table (there
is no locationid, locname).

so If I retrieve data from that table (to array) I will have array of locations.
e.g. $data = array('location1', 'location2', ... and so on);

in my form, if I have to hand code to fill the select, I will be doing
something like this:

       $location= New Zend_Form_Element_Select('location');
       $location->setLabel('*Location:');
       $location->setMultiOptions(array('location1' => 'location1',
'location2' => 'location2' .... and so on));

My question is how do I do the same thing with the previous method (
controller passes the retrieved data to form and form will iterate to
populate data in select element).

I guess it is clear now.
- Hide quoted text -

Thanks

--
=======================
Registered Linux User #460714
Currently Using Fedora 8, 10
=======================

Reply via email to