Damn, I met this issue 2 months ago and I was persuaded it was a regular
behavior of subforms...


On Thu, Apr 23, 2009 at 4:32 PM, Matthew Weier O'Phinney
<matt...@zend.com>wrote:

> -- Guillaume Oriol <gor...@technema.fr> wrote
> (on Thursday, 23 April 2009, 07:14 AM -0700):
> > I designed a generic CRUD controller doing the following operations for
> the
> > CREATE action:
> >
> >         if ($this->_request->isPost()) {
> >             $formData = $this->_request->getPost();
> >             if ($form->isValid($formData)) {
> >                 $row = $this->_model->createRow();
> >                 $row->setFromArray($form->getValues());
> >                 $row->save();
> >                 $this->goBack(); // Exit here
> >             }
> >             // Repopulate the form if it is not valid
> >             $form->populate($formData);
> >         }
> >         ...
> >
> > When my form has no subform, everything is okay, but when my form has
> subforms,
> > no data is saved.
> > What am I supposed to do when using subforms? Iterating thru subforms to
> get
> > the data?
> >
> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
> > Without subforms $form->getValues() returns an array like:
> >
> > array (
> >   'name' => 'aaa',
> >   'description' => 'bbb',
> >   'submit' => 'submit',
> > )
> >
> > With subforms, $form->getValues() returns something like:
> >
> > array (
> >   'submit' => 'submit',
> >   '' => array (
> >     'name' => 'aaa',
> >     'description' => 'bbb',
> >   )
> > )
>
> This behavior was recently reported on the issue tracker and fixed in
> trunk, iirc.
>
> --
> Matthew Weier O'Phinney
> Project Lead            | matt...@zend.com
> Zend Framework          | http://framework.zend.com/
>



-- 
Thomas VEQUAUD          http://thomas.vequaud.free.fr/
Expert EPITECH en Ingénierie Informatique
Tél : +33(0)6.50.39.28.10  Fax: +33(0)9.58.46.10.07

Reply via email to