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.
没有评论:
发表评论