|
Hi in my Zend Form file I tested this setValue code to make a specified row
selected in the drop down list. And it works but... *class Form_Album extends Zend_Form* //__________________________________________________Peacocksuit.com $category = new Zend_Form_Element_Select('category'); $category->setLabel('Category') ->setRequired(true); $category->addMultiOption('',""); $CatLIST = new Model_DbTable_Category(); foreach ($CatLIST->fetchAll() as $CatID) { $category->addMultiOption($CatID->id, $CatID->title); } * //$category->setValue('2'); // Problem* //__________________________________________________Peacocksuit.com ... But my IndexController's editAction() is the one handling the populating of $formData. How can I send $billy[category_id] to my Zend_Form's $category->setValue() function? Or vice versa make my editAction() do the setValue to my Zend_Form? class *IndexController* extends Zend_Controller_Action *public function editAction()* //_________________________________________________________Billy echo "Billy"; $billy = $albums->getAlbum($id); Zend_Debug::dump($billy); echo "I ain't afraid of no man: " . *$billy[category_id]*; exit(); //_________________________________________________________Billy |
|
How about in:
editAction(){ $form->category->setValue($billy['category_id']); } where category is the name of the element as you have added it in the form. On 10/08/2010 02:44 PM, W Itch wrote: > Hi in my Zend Form file I tested this setValue code to make a specified row > selected in the drop down list. And it works but... > > > *class Form_Album extends Zend_Form* > > //__________________________________________________Peacocksuit.com > > $category = new Zend_Form_Element_Select('category'); > $category->setLabel('Category') > ->setRequired(true); > $category->addMultiOption('',""); > > $CatLIST = new Model_DbTable_Category(); > foreach ($CatLIST->fetchAll() as $CatID) { > $category->addMultiOption($CatID->id, $CatID->title); > } > > * //$category->setValue('2'); // Problem* > //__________________________________________________Peacocksuit.com > > > > > > ... But my IndexController's editAction() is the one handling the populating > of $formData. > How can I send $billy[category_id] to my Zend_Form's $category->setValue() > function? > Or vice versa make my editAction() do the setValue to my Zend_Form? > > class *IndexController* extends Zend_Controller_Action > *public function editAction()* > > //_________________________________________________________Billy > echo "Billy"; > $billy = $albums->getAlbum($id); > Zend_Debug::dump($billy); > > echo "I ain't afraid of no man: " . *$billy[category_id]*; > > exit(); > //_________________________________________________________Billy > |
| Powered by Nabble | Edit this page |
