Zend Forms

Posted in development on December 4th, 2008 by admin

It’s being a while since my last Zend-related post. Now I’ll try to cover approach to Zend_Form usage. This component has really extensive functionality. You can use Zend_Form in a straightforward manner by creating form elements in your controller’s code:


protected function prepareForm() {
    $form = new Zend_Form();

    $query = new Zend_Form_Element_Text('query');
    $form->addElement($query);

    // ...

    $submit = new Zend_Form_Element_Submit('submit');
    $submit->setLabel('Search');
    $form->addElement($submit);

    return $form;
}

Read more »

Tags: ,