The form->populate() method takes an array where the keys are the names of the form fields.
The Zend_Db_Table_Row object implements a toArray() method which can be used here (as do many other objects). So you can do stuff like: $form = new MyForm; $table = new MyTable; $rowset = $table->find($id); $row = $rowset->current(); $form->populate($row->toArray()); Hope that helps! Mark ierpe wrote: > > Hi, > > I am pretty new to ZF and I started building an MVC app with it. > > I already implemented some models, controllers and simple views, but I > have a problem with my edit/update actions. > I cannot find a way to insert values retrieved from the db into my edit > forms. > > I have seen in the and ZF documentation that there is a > $form->populate($data) method and a $form->setDefaults ($data) that are > supposed to fill the form with the $data values. My form input names are > the same than in the db, so im just retrieving the $data from the db and I > expected the function to fill it for me, but it doesnt... > > Also I installed Dojo now and my forms are Dojo's now, could it be linked? > Please if you know a solution or a good post/tutorial on how to do this it > would be much appreciated! > > -- View this message in context: http://www.nabble.com/Zend%2BDojo%2B-Edit-Form-tp24387814p24389098.html Sent from the Zend Framework mailing list archive at Nabble.com.
