Php 将Zend_Form_Element_文本转换为Zend_Form_Element_Hidden
在我的控制器脚本中,我有以下内容:Php 将Zend_Form_Element_文本转换为Zend_Form_Element_Hidden,php,zend-framework,Php,Zend Framework,在我的控制器脚本中,我有以下内容: $customer_el = $this->view->form->getElement('customer_id'); Zend_Debug::dump($customer_el); 它的输出是 object(Zend_Form_Element_Text)#13 (26) { ["helper"] => string(8) "formText" ["_allowEmpty":protected] => bool(tru
$customer_el = $this->view->form->getElement('customer_id');
Zend_Debug::dump($customer_el);
它的输出是
object(Zend_Form_Element_Text)#13 (26) {
["helper"] => string(8) "formText"
["_allowEmpty":protected] => bool(true)
["_autoInsertNotEmptyValidator":protected] => bool(true)
["_belongsTo":pro
... and so on.....
是否可以将$customer\u el变量转换为Zend\u Form\u Element\u Hidden??
如果是这样,怎么做?主要目的是隐藏表单元素,然后只需使用更改该元素的decorators<代码>$element->setDecorators(数组(数组('ViewScript',数组('ViewScript'=>'隐藏部分.phtml'的路径))代码>+1表示正确答案。但我实际做的是:取消设置($this->\u config->model->\u form->customer\u id);你为什么用unset?这是为了删除表单元素吗?@php-dev在本例中,它将删除表单元素。