Actions

Source Code of This Project

/lib/form/contactForm.php

<?php
/*
 * This file is part of the pwp package.
 * (c) 2009-2010 Victor Rad' <victor.v.rad[at]gmail.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
*/

/**
 * Forms for contact page
 *
 * @package    pwp
 * @subpackage contact
 * @author     Victor Rad'
 */
class contactForm extends BaseForm
{

    public function configure()
    {
        // set widgets
        $this->widgetSchema['name'] = new sfWidgetFormInputText();
        $this->widgetSchema['email'] = new sfWidgetFormInputText();
        $this->widgetSchema['message'] = new sfWidgetFormTextarea();

        // set validators
        $this->validatorSchema['name'] = new sfValidatorString(array('max_length' => 100, 'required' => false));
        $this->validatorSchema['email'] = new sfValidatorEmail(array('max_length' => 100));
        $this->validatorSchema['message'] = new sfValidatorString(array('max_length' => 2000));

        // set labels
        $this->widgetSchema->setLabels(array(
                'name'    => 'Your name',
                'email'   => 'Your email address',
                'message' => 'Your message',
        ));

        $this->widgetSchema->setNameFormat('contact[%s]');
    }

}