Is there a method available to make Zend_Form sticky in the event it isn't
valid? I came up with the code below, but couldn't determine if there was
something already built in to Zend_Form  for doing this.

if (!$form->isValid($data)) {

    $elements = $form->getElements();

    foreach ($elements as $element) {
        if ( !isset($data[$element->getName()]) ) {
            continue;
        }
        $element->setValue($data[$element->getName()]);
    }
    $this->view->form = $form;
    return $this->render('subscribe');

} else {

// VALID FORM

}

Reply via email to