How to unset elements in zend form

Use Zend_Form::removeElement(). See http://framework.zend.com/manual/en/zend.form.forms.html#zend.form.forms.elements.methods

Example

$form->removeElement('merchantLogo');

This is quiete easy:

$this->removeElement('merchantLogo');

The public function removeElement() on the Zend_Form takes the name of an element and removes it from the form.

See: http://framework.zend.com/manual/en/zend.form.forms.html#zend.form.forms.elements.methods


1:

$element = new Zend_Form_Element_Text('test');
if ($condition) {
    $form->addElement($element);
}

2:

$element = new Zend_Form_Element_Text('test');
$form->addElement($element);
if (!$condition) {
    $form->removeElement('test');
}