if($this->getDisplayGroup('hiddenFields')) {
$this->getDisplayGroup('hiddenFields')->addElement($oHidden);
Without seeing more of your implementation I can’t verify that.
Paul Shoemaker | Application Developer
paul.shoemaker@helloecho.com
615.290.4342 | 615.777.5119 fax
echo | Hello. Hello. | helloecho.com
The information contained in this message is intended only for the use of the individual or entity named above. If the reader of this message is not the intended recipient, or the employee or agent responsible for delivering it to the intended recipient, you are hereby notified that any dissemination, distribution, or copying of this communication is strictly prohibited.
From: Axel Wüstemann <awu@qbus.de>
Date: Tue, 5 Aug 2008 14:29:53 -0500
To: <fw-mvc@lists.zend.com>
Subject: [fw-mvc] Zend_Form_Element will be created twice
Hi,
why the second hidden element will be created twice?
class EventForm extends My_Form {
public function init() {
$this->addHiddenElement('ID');
$this->addHiddenElement('PARENT_ID');
}
}
class My_Form extends Zend_Form {
protected $_aHiddenDecorators = array(
array('ViewHelper')
);
protected $_aHiddenGroupDecorators = array(
'FormElements'
);
public function loadDefaultDecorators() {
$this->setDecorators(array(
'FormElements',
'Form',
));
}
/**
* builds a hidden element and adds it to the 'hiddenFields' display
group
* if the display group does not yet exists, it will be created
*/
public function addHiddenElement($fp_sName, $fp_aOptions = null) {
$oHidden = $this->createElement('hidden', $fp_sName, $fp_aOptions);
$oHidden->setDecorators($this->_aHiddenDecorators);
$this->addElement($oHidden);
if($this->getDisplayGroup('hiddenFields')) {
$this->getDisplayGroup('hiddenFields')->addElement($oHidden);
} else {
$this->addDisplayGroup(array($oHidden->getName()),
'hiddenFields', array(
'decorators' => $this->_aHiddenGroupDecorators,
));
}
}
<form enctype="application/x-www-form-urlencoded" action=".." method="post">
<input type="hidden" name="ID" value="" id="ID">
<input type="hidden" name="PARENT_ID" value="" id="PARENT_ID">
<input type="hidden" name="PARENT_ID" value="" id="PARENT_ID">
</form>
thank you for any help,
Axel
--
View this message in context: http://www.nabble.com/Zend_Form_Element-will-be-created-twice-tp18838277p18838277.html
Sent from the Zend MVC mailing list archive at Nabble.com.
没有评论:
发表评论