setName('Register'); $username = new Zend_Form_Element_Text('username'); $username->setLabel('用户名')->setRequired(true) ->addFilter('StripTags') ->addFilter('StringTrim') ->addValidator('StringLength',false,array(3,50)) ->addPrefixPath('Validator','validator/','validate') ->addValidator('NotInTable',false,array('username')); $password=new Zend_Form_Element_Password('password'); $password->setLabel('密码') ->setRequired(true) ->setDescription('长度在6到20位字符之间') ->addValidator('StringLength',false,array(6,20)); $password_confirm=new Zend_Form_Element_Password('password_confirm'); $password_confirm->setLabel('确认密码')->addPrefixPath('Validator','validator/','validate') ->setRequired(true)->addValidator('Confirmation',false,array('password')); $email=new Zend_Form_Element_Text('email'); $email->setLabel('E-Mail') ->setRequired(true) ->addFilter('StringTrim') ->addValidator('NotEmpty') ->addValidator('EmailAddress'); $email_repeat=new Zend_Form_Element_Text('email_repeat'); $email_repeat->setLabel('确认E-Mail') ->setRequired(true) ->addPrefixPath('Validator','validator/','validate') ->addValidator('NotInTable',false,array('email')) ->addValidator('Confirmation',false,array('email')); $realname=new Zend_Form_Element_Text('realname'); $realname->setLabel('真实姓名')->setRequired(false); $phone=new Zend_Form_Element_Text('phone'); $phone->setLabel('电话')->setRequired(false); $unit=new Zend_Form_Element_Text('unit'); $unit->setLabel('单位')->setRequired(false); $address=new Zend_Form_Element_Text('address'); $address->setLabel('联系地址')->setRequired(false); $project=new Zend_Form_Element_Textarea('project'); $project->setLabel('科研项目')->setRequired(false)->setAttrib('rows',4); $id = new Zend_Form_Element_Hidden('id'); $submit = new Zend_Form_Element_Submit('注册'); $submit->setAttrib('id', 'submitbutton'); $this->addElements(array($id, $username,$password,$password_confirm,$email,$email_repeat,$realname,$phone,$unit,$address,$project,$submit)); $this->clearDecorators(); $this->addDecorator('FormElements') ->addDecorator('HtmlTag', array('tag' => '