Jay*_*oso 2 php zend-framework zend-form-sub-form
大家好!我在这里设置子表单元素,它工作正常.
//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');
Run Code Online (Sandbox Code Playgroud)
我仍然在摆弄并想知道如何在表单提交时访问子表单元素,以设置其值.干杯和快乐的编码!谢谢
虽然目前尚不清楚是什么$this,但以下情况应该有效:
$this->form->getSubForm('sampleSubForm')->test->setValue('some value');
Run Code Online (Sandbox Code Playgroud)