I have a form based on Zend_Form.
When form isn't valid, my inputs contain data.
But if all OK, after submiting form conains all data.
I know how clear form with help of jQuery.
But how I make it in Zend Framework?
In your controller, after you have checked that your form is submitted and valid, and you have handled the data, you can try:
$form->reset();
in order to clean the form. More info in the ZF manual here: http://framework.zend.com/manual/en/zend.form.forms.html#zend.form.forms.elements.values
Unfortunately this does not work in ZEND 2. See the code below to clear a form in ZEND 2
$elements = $form->getElements();
foreach ($elements as $element) {
if ($element instanceof \Zend\Form\Element\Text) {
$element->setValue('');
}
// Other element types here
}