我正在使用一系列嵌入了子表单的表单,我正在尝试确定是否可以让 getValues 返回没有子表单上的数组表示法的值。
IE:
$form = new Zend_Form();
$subForm = new Zend_Form_SubForm();
$form->addSubForm( $subForm, 'contact' );
$form->addElement(new Zend_Form_Element_Text('name'));
$subForm->addElement( new Zend_Form_Element_Text('phone') );
var_dump($form->getValues());
给我输出:
array(2) {
["name"]=>
NULL
["contact"]=>
array(1) {
["phone"]=>
NULL
}
}
但我实际上希望输出是:
array(2) {
["name"]=>
NULL
["phone"]=>
NULL
}
在不覆盖 Zend_Form 函数的情况下有什么简单的方法吗?