<?php
class Application_Form_UserForm extends Zend_Form
{
public function init()
{
$fname = $this->createElement('text','firstName')
->setLabel('First Name*')
->setRequired(true)
->setAttrib('size', '15');
$lname = $this->createElement('text','lastName')
->setLabel('Last Name*')
->setRequired(true)
->setAttrib('size', '15');
$email = $this->createElement('text', 'email', array(
'label' => 'Email Address*',
'required' => true,
'validators' => array(
array('NotEmpty', true, array('messages' => 'Please Enter Email')),
array('regex', false, array('pattern' => '/^[a-z0-9_\+-]+(\.[a-z0-9_\+-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*\.([a-z]{2,4})$/',
'messages'=>array(Zend_Validate_Regex::NOT_MATCH=>'%value% is not a valid Email')
)))
)
);
$password = new Zend_Form_Element_Password('password');
$password->setLabel('Password*')
->setRequired(true)
->addFilter(new Zend_Filter_StringTrim())
->addValidator(new Zend_Validate_NotEmpty())
->setAttrib('size',15);
$password2 = new Zend_Form_Element_Password('confirm_password');
$password2->setLabel('Confirm Password*')
->setRequired(true)
->addFilter(new Zend_Filter_StringTrim())
->addValidator('Identical', false, array('token'=>'password', 'messages'=>'Passwords mismatch!' ) )
->setAttrib('size',15);
$captcha = new Zend_Form_Element_Captcha('captcha', array(
'label' => 'Security Check',
'required' => true,
'captcha' => array(
'captcha' => 'Image',
'font' => APPLICATION_PATH . '/../public/captcha/AllerDisplay.ttf',
'fontSize' => '24',
'wordLen' => 6,
'height' => '50',
'width' => '150',
'imgDir' => APPLICATION_PATH . '/../public/captcha',
'imgUrl' => Zend_Controller_Front::getInstance()->getBaseUrl() . '/captcha',
)
));
$submit = $this->createElement('submit', 'submit')
->setAttrib('class', 'botton')
->setName('Submit');
$this->addElements(array($fname, $lname, $email, $password, $password2, $captcha, $submit));
}
}
?>
class Application_Form_UserForm extends Zend_Form
{
public function init()
{
$fname = $this->createElement('text','firstName')
->setLabel('First Name*')
->setRequired(true)
->setAttrib('size', '15');
$lname = $this->createElement('text','lastName')
->setLabel('Last Name*')
->setRequired(true)
->setAttrib('size', '15');
$email = $this->createElement('text', 'email', array(
'label' => 'Email Address*',
'required' => true,
'validators' => array(
array('NotEmpty', true, array('messages' => 'Please Enter Email')),
array('regex', false, array('pattern' => '/^[a-z0-9_\+-]+(\.[a-z0-9_\+-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*\.([a-z]{2,4})$/',
'messages'=>array(Zend_Validate_Regex::NOT_MATCH=>'%value% is not a valid Email')
)))
)
);
$password = new Zend_Form_Element_Password('password');
$password->setLabel('Password*')
->setRequired(true)
->addFilter(new Zend_Filter_StringTrim())
->addValidator(new Zend_Validate_NotEmpty())
->setAttrib('size',15);
$password2 = new Zend_Form_Element_Password('confirm_password');
$password2->setLabel('Confirm Password*')
->setRequired(true)
->addFilter(new Zend_Filter_StringTrim())
->addValidator('Identical', false, array('token'=>'password', 'messages'=>'Passwords mismatch!' ) )
->setAttrib('size',15);
$captcha = new Zend_Form_Element_Captcha('captcha', array(
'label' => 'Security Check',
'required' => true,
'captcha' => array(
'captcha' => 'Image',
'font' => APPLICATION_PATH . '/../public/captcha/AllerDisplay.ttf',
'fontSize' => '24',
'wordLen' => 6,
'height' => '50',
'width' => '150',
'imgDir' => APPLICATION_PATH . '/../public/captcha',
'imgUrl' => Zend_Controller_Front::getInstance()->getBaseUrl() . '/captcha',
)
));
$submit = $this->createElement('submit', 'submit')
->setAttrib('class', 'botton')
->setName('Submit');
$this->addElements(array($fname, $lname, $email, $password, $password2, $captcha, $submit));
}
}
?>