1
我正在处理一系列具有嵌入到它们中的子表单的表单,并试图解决如果我可以让getValues返回没有数组表示形式的值。Zend_Form_SubForm扁平化数组表示法getValues()
即:
$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函数?