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',
  )
)


-----
Guillaume ORIOL
Sofware architect
Technema
-- 
View this message in context: 
http://www.nabble.com/expected-behavior-of-getValues%28%29-on-subform-tp23197354p23197354.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to