tags:

views:

14

answers:

1

I am having trouble injecting form data back into the form so the form is not reset if it is invalid.

Any way to do that? Or, more importantly, best/most ideal way?

I have my form logic and checking, just need a little help in exactly where I should be focusing the above effort.

Thanks!

A: 

Yeah, the $form->isValid($_POST) call should handle it. For example:

$form = new Zend_Form();
$form->setAction('/submit');
$form->setMethod('post');
$form->addElement('text', 'first_name', array(
    'label' => 'First Name:',
    'required' => true));
if (!$form->isValid($_POST)) {
    //handle errors
} else {
    //success
}
weotch