Thorazine 10mg Online
10 Principles Of Effective Web Design »
  • 13th February 2008 - By Vinu Thomas

    Usually handing forms involves coding the form in HTML and performing client and server side validation, which usually makes the code for complex forms quite unwieldy. Zend_Form which is available in Zend Framework version 1.5 aims at simplifying this process.

    You can now create and add methods for validating form fields completely in Zend_Form. Here’s an example from an article at Zend Developer Zone:

    $form = new Zend_Form;
    $form->setAction('/resource/process')
        ->setMethod('post')
        ->setAttrib('id', 'login');
    $username = new Zend_Form_Element_Text('username');
    $username->addValidator('alnum')
        ->addValidator('regex', false, array('/^[a-z]/i'))
        ->setRequired(true)
        ->addFilter('StringToLower');
    $form->addElement($username);
    $password = new Zend_Form_Element_Password('password');
    $password->addValidator('stringLength', false, array(6))
        ->setRequired(true)
    $form->addElement($password);
    $form->addElement(new Zend_Form_Element_Submit());

    To learn more on this head over to the Zend_Form Quick start guide at : http://framework.zend.com/manual/en/zend.form.quickstart.html or an article by Cal Evans at Zend Developer Zone: Lifting the Skirt on Zend Framework 1.5 – Zend_Form

  • 2 Comments to “Quicker and cleaner Form using Zend Form”

    • vinu on February 13, 2008

      A few more advanced form techniques using Zend Framework are available at: http://gourl.in/0j

    • PHPDeveloper.org on February 13, 2008

      Vinu Thomas’ Blog: Quicker and cleaner Form using Zend Form…

      On his blog today, Vinu Thomas has an example of what ……

    Leave a Reply