setName('OfflinePdf'); $email=new Zend_Form_Element_Text('email'); $email->setLabel('E-Mail') ->addFilter('StringTrim') ->addValidator('NotEmpty') ->setRequired(true) ->addValidator('EmailAddress'); $realname=new Zend_Form_Element_Text('realname'); $realname->setLabel('真实姓名')->setRequired(true); $phone=new Zend_Form_Element_Text('phone'); $phone->setLabel('电话')->setRequired(true); $unit=new Zend_Form_Element_Text('unit'); $unit->setLabel('单位')->setRequired(true); $postcode=new Zend_Form_Element_Text('postcode'); $postcode->setLabel('邮编')->setRequired(true); $address=new Zend_Form_Element_Text('address'); $address->setLabel('联系地址')->setRequired(true); $project=new Zend_Form_Element_Textarea('project'); $project->setLabel('用途(包括项目名称、编号、类型、使用目的)')->setRequired(true)->setAttrib('rows',2); $id = new Zend_Form_Element_Hidden('id'); $save = new Zend_Form_Element_Submit('save'); $save->setAttrib('id', 'savebutton')->setLabel('保存并预览PDF'); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton')->setLabel('提交申请到数据中心'); /*$submit->setDecorators(array( 'ViewHelper', 'Description', 'Errors', //array(array('elementDiv' => 'HtmlTag'), array('tag' => 'div')), array(array('dl' => 'HtmlTag'), array('tag' => 'dl','class'=>'submit')) )); $this->setDecorators(array( 'FormElements', array('HtmlTag', array('tag' => 'dl', 'class' => 'userform')), array('Description', array('placement' => 'prepend')), 'Form' ));*/ $this->addElements(array($realname,$email,$phone,$unit,$address,$postcode,$project,$id,$save,$submit)); } }