setName('login');
$username = new Zend_Form_Element_Text('username');
$username->setLabel('用户名')
->setRequired(true)
->addFilter('StripTags')
->addFilter('StringTrim')
->addValidator('NotEmpty');
$password=new Zend_Form_Element_Password('password');
$password->setLabel('密码')->setRequired(true);
$remember=new Zend_Form_Element_Checkbox('remember');
$remember->setLabel('记住我');
$id = new Zend_Form_Element_Hidden('id');
$submit = new Zend_Form_Element_Submit('submit');
$submit->setLabel('登录');
$submit->setAttrib('id', 'submitbutton');
$this->addElements(array($id, $username, $password, $remember));
$this->clearDecorators();
$this->addDecorator('FormElements')
->addDecorator('HtmlTag', array('tag' => '
','class'=>'loginform'))
->addDecorator('Form');
/*
$this->setElementDecorators(array(
array('ViewHelper'),
array('Errors'),
array('Description'),
array('Label', array('separator'=>' ')),
array('HtmlTag', array('tag' => 'li', 'class'=>'element-group')),
));
*/
$captcha = $this->addElement('captcha', 'captcha', array(
'captcha' => array(
// First the type...
'captcha' => 'Image',
// Length of the word...
'wordLen' => 4,
'fontsize'=>16,
'width' => 100,
'height' => 38,
'dotNoiseLevel'=>2,
'lineNoiseLevel'=>1,
// Captcha timeout, 5 mins
'timeout' => 300,
// What font to use...
'font' => '../data/fonts/ggbi.ttf',
// Where to put the image
'imgDir' => 'vdimg/',
// URL to the images
// This was bogus, here's how it should be... Sorry again :S
'imgUrl' => '/vdimg',
),
'label' => '验证码'
));
/*
// buttons do not need labels
$submit->setDecorators(array(
array('ViewHelper'),
array('Description'),
array('HtmlTag', array('tag' => 'li', 'class'=>'submit-group')),
));
*/
$this->addElements(array($submit));
}
}