<?php
class Application_Form_Example extends Zend_Form
{
public function init()
{
$this->addElement('text', 'firstName', array(
'required' => true,
'label' => 'First Name',
'validators' => array('Alnum')
));
$this->addElement('text', 'lastName', array(
'required' => true,
'label' => 'Last Name',
'validators' => array('Alnum')
));
$this->addElement('text', 'email', array(
'label' => 'Email Address',
'validators' => array('EmailAddress')
));
$this->addElement('radio', 'tree', array(
'required' => true,
'label' => 'Are you a tree?',
'multiOptions' => array('yes' => 'Yes', 'no' => 'No'),
'validators' => array(new Zend_Validate_InArray(array('yes', 'no')))
));
$this->addElement('multiCheckbox', 'interests', array(
'label' => 'Interests (check all that apply)',
'required' => true,
));
$this->addElement('select', 'referral', array(
'label' => 'How did you hear about us?',
'required' => true
));
$this->addElement('textarea', 'comments', array(
'label' => 'Comments',
'cols' => '30',
'rows' => '5'
));
$this->addElement('submit', 'Submit');
// Sets specified filters on all elements in the form
$this->setElementFilters(array('StripTags', 'StringTrim'));
}
}