Zend_Form_Element ignore flag not working?
I learnt that开发者_如何学运维 I can set the ignore
flag on a Zend_Form_Element
so that it's ignored when getting values etc.
I have
$this->addElement('submit', 'btnLogin', array(
'label' => 'Login',
'ignore' => true
));
But when I do
foreach ($this->getElements() as $elem) {
echo $elem->getName() . "<br />";
}
It stills includes the btnLogin
The ignore
-flag will only ensure that the form element does not get a is not included when retrieving the form values on the form level (name
-attribute effectively removing it from the posted form data$form->getValues()
). You won't get the element's value when doing e.g.:
foreach ($form->getValues() as $name => $value) {
// ...
}
精彩评论