public function init() { $this->setName(strtolower(get_class())); $this->setMethod("post"); $oFormName = new Zend_Form_Element_Hidden("form_name"); $oFormName->setValue(get_class()); $oFormName->setIgnore(FALSE)->removeDecorator("Label"); $this->addElement($oFormName); $oMessage = new Zend_Form_Element_Textarea("message"); $oMessage->setFilters($this->_aFilters); $oMessage->setRequired(FALSE); $oMessage->removeDecorator("label"); $this->addElement($oMessage); $oIsDing = new Zend_Form_Element_Checkbox("is_ding"); $oIsDing->setLabel("Włącz dźwięk"); $oIsDing->setValue(1); $this->addElement($oIsDing); $oSubmit = new Zend_Form_Element_Submit("send_message"); $oSubmit->setLabel("Wyślij wiadomość"); $this->addElement($oSubmit); $oViewScript = new Zend_Form_Decorator_ViewScript(); $oViewScript->setViewModule("admin"); $oViewScript->setViewScript("_forms/chat.phtml"); $this->clearDecorators(); $this->setDecorators(array(array($oViewScript))); $oElements = $this->getElements(); foreach ($oElements as $oElement) { $oElement->setFilters($this->_aFilters); $oElement->removeDecorator("Errors"); } }
function setForm() { $form = new Zend_Form; $form->setMethod('post')->setAction(''); //$this->setAttrib('enctype','multipart/form-data'); $file = new Zend_Form_Element_File('video_file'); //$file->setAttrib('class','file'); $file->setLabel('video_file'); $file->setRequired(true); $video_title = new Zend_Form_Element_Text('video_title'); $video_title ->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Tiêu đề không được để trống')); $video_thumbnail=new Zend_Form_Element_Textarea('video_thumbnail'); $video_thumbnail->removeDecorator('HtmlTag')->removeDecorator('Label'); $video_description = new Zend_Form_Element_Textarea('video_description'); $video_description->setAttrib('rows','7'); $video_description ->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Mô tả không được để trống')); $is_active = new Zend_Form_Element_Radio('is_active'); $is_active->setRequired(true) ->setLabel('is_active') ->setMultiOptions(array("1" => "Có","0" => "Không")); $file->removeDecorator('HtmlTag')->removeDecorator('Label'); $video_title->removeDecorator('HtmlTag')->removeDecorator('Label'); $video_description->removeDecorator('HtmlTag')->removeDecorator('Label'); $is_active->removeDecorator('HtmlTag')->removeDecorator('Label'); $form->addElements(array($file,$video_title,$video_description,$is_active,$video_thumbnail)); return $form; }
function setForm() { $form=new Zend_Form; $form->setMethod('post')->setAction(''); $image_name = new Zend_Form_Element_Text('image_name'); $image_name->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Tên ảnh không được để trống')); $image_link = new Zend_Form_Element_Textarea('image_link'); $image_link->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Hình ảnh không được để trống')); $is_active = new Zend_Form_Element_Radio('is_active'); $is_active->setRequired(true) ->setLabel('is_active') ->setMultiOptions(array("1" => "Có","0" => "Không")); $image_name->removeDecorator('HtmlTag')->removeDecorator('Label'); $image_link->removeDecorator('HtmlTag')->removeDecorator('Label'); $is_active->removeDecorator('HtmlTag')->removeDecorator('Label'); $form->addElements(array($image_name,$image_link,$is_active)); return $form; }
function setForm() { $form=new Zend_Form; $form->setMethod('post')->setAction(''); $ads_banner = new Zend_Form_Element_Textarea('ads_banner'); $ads_banner->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Biểu ngữ không được để trống')); $ads_position = new Zend_Form_Element_Text('ads_position'); $ads_position->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Vị trí không được để trống')); $ads_name = new Zend_Form_Element_Text('ads_name'); $ads_name->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Tên quảng cáo không được để trống')); $ads_link = new Zend_Form_Element_Text('ads_link'); $ads_link->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Đường dẫn không được để trống')); $ads_position = $form->createElement("select","ads_position",array( "label" => "Vị trí", "multioptions"=> array( "1" => "Trên", "2" => "Giữa", "3" => "Trái", "4" => "Phải", "5" => "Nội dung"))); $ads_banner->removeDecorator('HtmlTag')->removeDecorator('Label'); $ads_position->removeDecorator('HtmlTag')->removeDecorator('Label'); $ads_name->removeDecorator('HtmlTag')->removeDecorator('Label'); $ads_link->removeDecorator('HtmlTag')->removeDecorator('Label'); $form->addElements(array($ads_banner,$ads_position,$ads_name,$ads_link)); return $form; }
public function init() { $formfield = new App_Form_Field(); $table = 'ourbank_productsoffer'; $fieldname1 = 'name'; $fieldname2 = 'shortname'; $offerproductupdate_id = new Zend_Form_Element_Hidden('offerproductupdate_id'); // $fieldtype,$fieldname,$table,$columnname,$cssname,$labelname,$required,$validationtype,$min,$max,$rows,$cols,$decorator,$value $product_id = $formfield->field('Select', 'product_id', '', '', 'mand', '', true, '', '', '', '', '', '', ''); $offerproductname = $formfield->field('Text', 'offerproductname', $table, $fieldname1, 'mand', '', true, '', '', '', '', '', '', ''); $offerproductshortname = $formfield->field('Text', 'offerproductshortname', $table, $fieldname2, 'mand', '', true, '', '', '', '', '', '', ''); $offerproductshortname->addValidator('StringLength', false, array(1, 3)); $offerproduct_description = new Zend_Form_Element_Textarea('offerproduct_description', array('rows' => 3, 'cols' => 20)); $offerproduct_description->setAttrib('class', ''); $offerproduct_description->removeDecorator('HtmlTag'); $offerproduct_description->setRequired(true)->addValidators(array(array('NotEmpty'))); $begindate = $formfield->field('Text', 'begindate', '', '', 'mand', '', true, '', '', '', '', '', '', ''); $closedate = $formfield->field('Text', 'closedate', '', '', 'mand', '', true, '', '', '', '', '', '', ''); $applicableto = $formfield->field('Select', 'applicableto', '', '', 'mand', '', true, '', '', '', '', '', '', ''); // $glsubcode_id = $formfield->field('Select','glsubcode_id','','','mand','',true,'','','','','','',''); // $fee_glsubcode_id = $formfield->field('Select','fee_glsubcode_id','','','mand','',true,'','','','','','',''); // $interest_glsubcode_id = $formfield->field('Select','interest_glsubcode_id','','','mand','',true,'','','','','','',''); $interesttype = $formfield->field('Select', 'interesttype_id', '', '', 'mand', '', true, '', '', '', '', '', '', ''); $minmumloanamount = $formfield->field('Text', 'minmumloanamount', '', '', 'mand', '', true, '', '', '', '', '', '', ''); $minmumloanamount->addValidators(array(array('stringLength', false, array(3, 10)))); $minmumloanamount->addValidators(array(array('Float'))); $maximunloanamount = $formfield->field('Text', 'maximunloanamount', '', '', 'mand', '', true, '', '', '', '', '', '', ''); $maximunloanamount->addValidators(array(array('stringLength', false, array(3, 10)))); $maximunloanamount->addValidators(array(array('Float'))); $minimumfrequency = $formfield->field('Text', 'minimumfrequency', '', '', 'mand', '', true, '', '', '', '', '', '', ''); $minimumfrequency->addValidators(array(array('stringLength', false, array(1, 3)))); $minimumfrequency->addValidators(array(array('Float'))); $maximumfrequency = $formfield->field('Text', 'maximumfrequency', '', '', 'mand', '', true, '', '', '', '', '', '', ''); $maximumfrequency->addValidators(array(array('stringLength', false, array(1, 3)))); $maximumfrequency->addValidators(array(array('Digits'))); $graceperiodnumber = $formfield->field('Text', 'graceperiodnumber', '', '', 'mand', '', true, '', '', '', '', '', '', ''); $graceperiodnumber->addValidators(array(array('stringLength', false, array(1, 1)))); $graceperiodnumber->addValidators(array(array('Digits'))); $penal_Interest = $formfield->field('Text', 'penal_Interest', '', '', 'mand', '', true, '', '', '', '', '', '', ''); $penal_Interest->addValidators(array(array('Float'))); $submit = $formfield->field('Submit', 'Submit', '', '', '', '', '', '', '', '', '', '', '', ''); $this->addElements(array($offerproductname, $offerproductshortname, $offerproduct_description, $offerproductupdate_id, $begindate, $closedate, $applicableto, $minmumloanamount, $maximunloanamount, $minimumfrequency, $maximumfrequency, $graceperiodnumber, $product_id, $submit, $penal_Interest, $interesttype)); }
/** * Inicializace formulare * */ public function init() { $this->setMethod(self::METHOD_POST); // ################## FIRST COLUMN ################### // datum pohovoru $elem = new Zend_Form_Element_Text('datum_pohovoru'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', array('form-control', 'date-picker')); $elem->setAttrib('placeholder', 'Pick a date…'); $elem->removeDecorator('Label'); $this->addElement($elem, 'datum_pohovoru'); // Multi select (perzonalista – pokročilé informace) $elem = new Zend_Form_Element_Multiselect('perzonalista_informace'); $elem->removeDecorator('Label'); $elem->setAttrib('placeholder', 'Pick an interviewers…'); $elem->setAttrib('class', 'form-control'); $this->addElement($elem, 'perzonalista_informace'); // vzdělání $elem = new Zend_Form_Element_Text('vzdelani'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', 'form-control'); $elem->setAttrib('placeholder', 'Education…'); $elem->removeDecorator('Label'); $this->addElement($elem, 'vzdelani'); // motivace $elem = new Zend_Form_Element_Textarea('motivace'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', 'form-control'); $elem->setAttrib('placeholder', 'Motivation…'); $elem->setAttrib('rows', '1'); $elem->removeDecorator('Label'); $this->addElement($elem, 'motivace'); // preferovaná práce $elem = new Zend_Form_Element_Textarea('preferovana_prace'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', 'form-control'); $elem->setAttrib('placeholder', 'Kind of work preferred…'); $elem->setAttrib('rows', '1'); $elem->removeDecorator('Label'); $this->addElement($elem, 'preferovana_prace'); // ambice $elem = new Zend_Form_Element_Textarea('ambice'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', 'form-control'); $elem->setAttrib('placeholder', 'Ambitions…'); $elem->setAttrib('rows', '1'); $elem->removeDecorator('Label'); $this->addElement($elem, 'ambice'); // jazyky $elem = new Zend_Form_Element_Text('jazyky'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', 'form-control'); $elem->setAttrib('placeholder', 'Languages…'); $elem->removeDecorator('Label'); $this->addElement($elem, 'jazyky'); // cestování $elem = new Zend_Form_Element_Text('cestovani'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', 'form-control'); $elem->setAttrib('placeholder', 'Travelling…'); $elem->removeDecorator('Label'); $this->addElement($elem, 'cestovani'); // ################## SECOND COLUMN ################### // plusy_minusy $elem = new Zend_Form_Element_Textarea('plusy_minusy'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', 'form-control'); $elem->setAttrib('placeholder', 'Pluses/Minuses…'); $elem->setAttrib('rows', '3'); $elem->removeDecorator('Label'); $this->addElement($elem, 'plusy_minusy'); // zkusenosti_v_tymu $elem = new Zend_Form_Element_Textarea('zkusenosti_v_tymu'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', 'form-control'); $elem->setAttrib('placeholder', 'Team work experience…'); $elem->setAttrib('rows', '3'); $elem->removeDecorator('Label'); $this->addElement($elem, 'zkusenosti_v_tymu'); // pracovni_misto $elem = new Zend_Form_Element_Textarea('pracovni_misto'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', 'form-control'); $elem->setAttrib('placeholder', 'Domain/Areas of work…'); $elem->setAttrib('rows', '3'); $elem->removeDecorator('Label'); $this->addElement($elem, 'pracovni_misto'); // knowhow $elem = new Zend_Form_Element_Textarea('knowhow'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', 'form-control'); $elem->setAttrib('placeholder', 'Skills and technologies…'); $elem->setAttrib('rows', '3'); $elem->removeDecorator('Label'); $this->addElement($elem, 'knowhow'); // dalsi_informace $elem = new Zend_Form_Element_Textarea('dalsi_informace'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', 'form-control'); $elem->setAttrib('placeholder', 'Other informations…'); $elem->setAttrib('rows', '3'); $elem->removeDecorator('Label'); $this->addElement($elem, 'dalsi_informace'); // ################## THIRD COLUMN ################### // shrnuti_pohovoru $elem = new Zend_Form_Element_Textarea('shrnuti_pohovoru'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', 'form-control'); $elem->setAttrib('placeholder', 'Summary of the interview…'); $elem->setAttrib('rows', '3'); $elem->removeDecorator('Label'); $this->addElement($elem, 'shrnuti_pohovoru'); // idealni_pozice $elem = new Zend_Form_Element_Text('idealni_pozice'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', 'form-control'); $elem->setAttrib('placeholder', 'Ideal for position/project…'); $elem->removeDecorator('Label'); $this->addElement($elem, 'idealni_pozice'); // datum_zahajeni $elem = new Zend_Form_Element_Text('datum_zahajeni'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', array('form-control', 'date-picker')); $elem->setAttrib('placeholder', 'Posible starting date…'); $elem->removeDecorator('Label'); $this->addElement($elem, 'datum_zahajeni'); // uvazek $elem = new Zend_Form_Element_Select('id_uvazek'); $elem->removeDecorator('Label'); $elem->setAttrib('class', 'form-control'); $this->addElement($elem, 'id_uvazek'); // mzda $elem = new Zend_Form_Element_Text('mzda'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', 'form-control'); $elem->setAttrib('placeholder', 'Salary…'); $elem->removeDecorator('Label'); $this->addElement($elem, 'mzda'); $elem = new Zend_Form_Element_Select('id_mena'); $elem->removeDecorator('Label'); $elem->setAttrib('class', 'form-control'); $this->addElement($elem, 'id_mena'); // datum_pristiho_kontaktu $elem = new Zend_Form_Element_Text('datum_pristiho_kontaktu'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', array('form-control', 'date-picker')); $elem->setAttrib('placeholder', 'Pick a date…'); $elem->removeDecorator('Label'); $this->addElement($elem, 'datum_pristiho_kontaktu'); // ###################### BUTTON ###################### $save = new Zend_Form_Element_Submit('saveButton'); $save->setLabel('Save'); $save->setAttrib('class', 'btn btn-success'); $save->setDecorators(array('ViewHelper')); $this->addElement($save, 'saveButton'); }
function setForm() { $form = new Zend_Form; $form->setAction('')->setMethod('post'); $comment_content = new Zend_Form_Element_Textarea('comment_content'); $comment_content->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Nội dung bình luận không được để trống')); $comment_content->setAttrib('rows', '5'); $news_id = new Zend_Form_Element_Select('news_id'); foreach($this->mComment->getListNews() as $news) { $news_id->addMultiOption($news['news_id'],$news['news_title']); } $comment_content->removeDecorator('HtmlTag')->removeDecorator('Label'); $news_id->removeDecorator('HtmlTag')->removeDecorator('Label'); $form->addElements(array($comment_content,$news_id)); return $form; }
function setForm() { $form = new Zend_Form; $form->setMethod('post')->setAction(''); $comment_name = new Zend_Form_Element_Text('comment_name'); $comment_name->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Vui lòng nhập tên người gửi !')); $comment_name->setAttrib('class','n'); $comment_name->setAttrib("onfocus","if (this.value == 'Nhập tên của bạn') {this.value = '';}"); $comment_name->setAttrib("onblur","if (this.value == '') {this.value = 'Nhập tên của bạn';}"); $comment_name->setValue("Nhập tên của bạn"); $comment_email = new Zend_Form_Element_Text('comment_email'); $comment_email->addValidator('EmailAddress',true,array('messages'=>'Địa chỉ email không hợp lệ')); $comment_email->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Vui lòng nhập địa chỉ email !')); $comment_email->setAttrib('class','e'); $comment_email->setAttrib('onfocus',"if (this.value == 'Nhập địa chỉ email của bạn') {this.value = '';}"); $comment_email->setAttrib('onblur',"if (this.value == '') {this.value = 'Nhập địa chỉ email của bạn';}"); $comment_email->setValue('Nhập địa chỉ email của bạn'); $comment_content = new Zend_Form_Element_Textarea('comment_content'); $comment_content->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Vui lòng nhập nội dung bình luận!')); $comment_content->setAttrib('class','m'); $comment_content->setAttrib('onfocus',"if (this.value == 'Nhập nội dung bình luận') {this.value = '';}"); $comment_content->setAttrib('onblur',"if (this.value == '') {this.value = 'Nhập nội dung bình luận';}"); $comment_content->setValue('Nhập nội dung bình luận'); $comment_captcha = new Zend_Form_Element_Captcha('comment_captcha',array( 'label' => 'Captcha_image', 'captcha' => array( 'captcha' => 'Image', 'wordLen' => 6, 'timeout' => 300, 'font' => APPLICATION_PATH.'/templates/front/fonts/tiennd.TTF', 'imgDir' => APPLICATION_PATH.'/templates/front/captcha/', 'imgUrl' => $this->view->baseUrl().'/application/templates/front/captcha/', 'height' => 100, 'width' => 200, 'fontSize' => 50, ), )); $comment_captcha->setAttrib('class','captcha_image1'); $comment_captcha->setAttrib('onfocus',"if (this.value == 'Nhập hình ảnh xác nhận') {this.value = '';}"); $comment_captcha->setAttrib('onblur',"if (this.value == '') {this.value = 'Nhập hình ảnh xác nhận';}"); $comment_captcha->setValue('Nhập hình ảnh xác nhận'); $comment_name->removeDecorator('HtmlTag')->removeDecorator('Label'); $comment_email->removeDecorator('HtmlTag')->removeDecorator('Label'); $comment_content->removeDecorator('HtmlTag')->removeDecorator('Label'); $comment_captcha->removeDecorator('HtmlTag')->removeDecorator('Label'); $form->addElements(array($comment_name,$comment_email,$comment_content,$comment_captcha)); return $form; }
function formInsert() { $form = new Zend_Form; $form->setMethod('post')->setAction(''); $link = new Zend_Form_Element_Text('link'); $link ->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Liên kết không được để trống')); $title = new Zend_Form_Element_Text('title'); $title ->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Tiêu đề không được để trống')); $description = new Zend_Form_Element_Textarea('description'); $description->setAttrib('rows', '5'); $description->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Mô tả không được để trống')); $is_active = $form->createElement("radio","is_active",array( "label" => "Kích hoạt", "multioptions"=> array( "1" => "Có", "0" => "Không"))); if($this->role == "0") { $listCategoryId = $this->mVideo->getListCategory(); } else { $listCategoryId = $this->mVideo->getCategoryIdByUserId($this->user_id); } $listCategory = array(); foreach($listCategoryId as $category) { $listCategory[] = $this->mVideo->getCategoryByCategoryId($category['category_id']); } $categoryId = new Zend_Form_Element_Select('category_id'); foreach($listCategory as $category) { $categoryId->addMultiOption($category['category_id'],$category['category_name']); } $link->removeDecorator('HtmlTag')->removeDecorator('Label'); $title->removeDecorator('HtmlTag')->removeDecorator('Label'); $description->removeDecorator('HtmlTag')->removeDecorator('Label'); $categoryId->removeDecorator('HtmlTag')->removeDecorator('Label'); $is_active->removeDecorator('HtmlTag')->removeDecorator('Label'); $form->addElements(array($link,$title,$description,$is_active,$categoryId)); return $form; }
/** * Add a textarea element to the form. * * @param array $question * * @return void */ private function _addMultiline($question) { $elemName = $question['FQT_TypeName'] . self::UNDERSCORE . $question['FQ_ElementID']; $element = new Zend_Form_Element_Textarea($elemName); $element->setAttribs(array('cols' => 23, 'rows' => 5)); $element->removeDecorator('DtDdWrapper'); $element->addDecorators(array('ViewHelper', array('HtmlTag', array('tag' => 'div', 'class' => 'answer-zone')))); $element->setAttrib('class', 'stdTextarea'); $this->_addExtras($element, $question); $this->addElement($element); $this->_displayGroupElements[] = $elemName; }
/** * Get textarea * @param string $id * @param string $value * @param array $elementequired * @return Zend_Form_Element_Textarea */ public function getTextArea($id, $value = "", $elementequired = false, $disable = false) { $element = new Zend_Form_Element_Textarea($id); $element->removeDecorator('HtmlTag'); $element->removeDecorator('DtDdWrapper'); $element->removeDecorator('Label'); $element->setValue($value); if ($elementequired) { $element->setAttribs(array('class' => 'validate[required]')); } if ($disable) { $element->setAttrib('disabled', 'disabled'); } return $element; }