setName('Datasetcd'); $title = new Zend_Form_Element_Text('title'); $title->setLabel('标题名')->setRequired(true) ->addFilter('StripTags') ->addFilter('StringTrim'); $size = new Zend_Form_Element_Text('size'); $size->setLabel('文件大小(M)')->setRequired(true) ->addFilter('Digits'); $uuid=new Zend_Form_Element_Text('uuid'); $uuid->setLabel('元数据UUID') ->setRequired(true) ->addFilter('StringTrim') ->addValidator('NotEmpty'); $img=new Zend_Form_Element_File('img'); $img->setLabel('上传缩略图') //->setRequired(true) ->setDestination('images/datasetcd') ->addValidator('Count', false, 1) // ensure only 1 file ->addValidator('Size', false, 102400) // limit to 100K ->addValidator('Extension', false, 'jpg,png,gif'); // only JPEG, PNG, and GIFs $document=new Zend_Form_Element_File('document'); $document->setLabel('数据文档') //->setRequired(true) ->setDestination('images/datasetcd') ->addValidator('Count', false, 1) // ensure only 1 file ->addValidator('Size', false, 10240000) // limit to 10M ->addValidator('Extension', false, 'pdf,doc'); // only JPEG, PNG, and GIFs $descript=new Zend_Form_Element_Textarea('descript'); $descript->setLabel('内容介绍')->setRequired(true)->setAttrib('rows',4); $id = new Zend_Form_Element_Hidden('id'); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton')->setLabel('发送'); $this->setAttrib('enctype', 'multipart/form-data'); $this->addElements(array($id, $title,$size,$uuid,$img,$document,$descript,$submit)); } }