Good day to all! What I have here is setting up subform elements and it works fine.
//Setting SubForm element
$subForm = new Zend_Form_SubForm();
$subForm->setName('sampleSubForm');
$subForm->addElement('text', 'test', array(
'value' => 'someValue',
'name' => 'test',
'belongsTo' => 'sampleSubForm',
'size' => '1',
'maxLength' => '1',
'decorators' => array('ViewHelper'),
));
$this->form->addSubForm($subForm, 'sampleSubForm');
I'd still keep fiddling and wondering how to access subform elements upon form submission, to set its value. Cheers and happy coding! thanks
Although it is not clear what $this
is, the following should work:
$this->form->getSubForm('sampleSubForm')->test->setValue('some value');