本文整理汇总了PHP中Zend_Form_Element_Textarea::setRequired方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form_Element_Textarea::setRequired方法的具体用法?PHP Zend_Form_Element_Textarea::setRequired怎么用?PHP Zend_Form_Element_Textarea::setRequired使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Form_Element_Textarea
的用法示例。
在下文中一共展示了Zend_Form_Element_Textarea::setRequired方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public function init()
{
$this->setMethod("post");
$title = new Zend_Form_Element_Text("title");
$title->setAttrib("placeholder", "Title");
$title->setAttrib("class", "form-control");
$title->setLabel("Title: ");
$title->setRequired();
$body = new Zend_Form_Element_Textarea("body");
$body->setAttrib("class", "form-control");
$body->setAttrib("placeholder", "Write body here....");
$body->setLabel("Body: ");
$body->setAttrib("rows", "5");
$body->setAttrib("cols", "55");
$body->setRequired();
$picture = new Zend_Form_Element_File('picture');
$picture->setLabel("Picture:");
$picture->setRequired();
$picture->setDestination('/var/www/html/RNR/public/images/thread');
$stick = new Zend_Form_Element_Radio("stick");
$stick->setLabel("Sticky:");
$stick->addMultiOption("on", "on");
$stick->addMultiOption("off", "off");
$stick->setRequired();
$id = new Zend_Form_Element_Hidden("id");
$submit = new Zend_Form_Element_Submit("Submit");
$submit->setAttrib("class", "btn btn-primary");
$submit->setLabel("Save");
$rest = new Zend_Form_Element_Submit('Rest');
$rest->setAttrib("class", "btn btn-info");
$this->addElements(array($id, $title, $body, $picture, $stick, $submit, $rest));
}
示例2: init
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");
}
}
示例3: init
public function init($catId)
{
global $mySession;
$db = new Db();
$catname = "";
$catdescription = "";
if ($catId != "") {
$Data = $db->runQuery("select * from " . CATEGORY . " where cat_id='" . $catId . "'");
$catname = $Data[0]['cat_name'];
$catdescription = $Data[0]['cat_description'];
}
$cat_name = new Zend_Form_Element_Text('cat_name');
$cat_name->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Category name is required.'))->addDecorator('Errors', array('class' => 'errormsg'))->setAttrib("class", "mws-textinput required")->setValue($catname);
$cat_description = new Zend_Form_Element_Textarea('cat_description');
$cat_description->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Category description is required.'))->addDecorator('Errors', array('class' => 'errormsg'))->setAttrib("class", "mws-textinput required")->setValue($catdescription);
/* $pagepositionArr=array();
$pagepositionArr[0]['key']="0";
$pagepositionArr[0]['value']="Top";
$pagepositionArr[1]['key']="1";
$pagepositionArr[1]['value']="Bottom";
$pageposition= new Zend_Form_Element_Radio('pageposition');
$pageposition->addMultiOptions($pagepositionArr)
->setValue($pageposition_value);
*/
$this->addElements(array($cat_name, $cat_description));
}
示例4: __construct
public function __construct($options = null)
{
parent::__construct($options);
parent::__construct();
$account_id = new Zend_Form_Element_Hidden('accountId');
$product_id = new Zend_Form_Element_Hidden('productId');
$newStatus = new Zend_Form_Element_Select('newStatus');
$newStatus->setAttrib('class', 'NormalBtn');
$newStatus->setRequired(true);
$newStatus->addMultiOption('', 'Select...');
$description = new Zend_Form_Element_Textarea('description');
$description->setAttrib('class', 'textfield');
$description->setAttrib('rows', '2');
$description->setAttrib('cols', '20');
$description->setRequired(true);
$newStatus1 = new Zend_Form_Element_Hidden('newStatus1');
$description1 = new Zend_Form_Element_Hidden('description1');
$submit = new Zend_Form_Element_Submit('Submit');
$submit->setLabel('submit');
$submit->setAttrib('class', 'recurring');
$Confirm = new Zend_Form_Element_Submit('Confirm');
$Confirm->setLabel('Confirm');
$Confirm->setAttrib('class', 'recurring');
$this->addElements(array($submit, $description, $newStatus, $account_id, $product_id, $Confirm, $newStatus1, $description1));
}
示例5: init
public function init($pageId)
{
global $mySession;
$db = new Db();
$PageTitle = "";
$PageContent = "";
$PageMetaKeyword = "";
$PageMetaDescription = "";
if ($pageId != "") {
$PageData = $db->runQuery("select * from " . PAGES1 . " where page_id='" . $pageId . "'");
// prd($PageData);
$PageTitle = $PageData[0]['page_title'];
$PageContent = $PageData[0]['page_content'];
$PageMetaKeyword = $PageData[0]['meta_keywords'];
$PageMetaDescription = $PageData[0]['meta_description'];
$PageSynonyms = $PageData[0]['synonyms'];
}
$page_title = new Zend_Form_Element_Text('page_title');
$page_title->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Page title is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($PageTitle);
$page_content = new Zend_Form_Element_Textarea('page_content');
$page_content->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Page content is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("id", "elrte")->setAttrib("cols", "auto")->setAttrib("rows", "auto")->setValue($PageContent);
$meta_keywords = new Zend_Form_Element_Text('meta_keywords');
$meta_keywords->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Keywords are required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($PageMetaKeyword);
$meta_description = new Zend_Form_Element_Text('meta_description');
$meta_description->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Description is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($PageMetaDescription);
$synonyms = new Zend_Form_Element_Text('synonyms');
$synonyms->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'URL is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($PageSynonyms);
$this->addElements(array($page_title, $page_content, $meta_keywords, $meta_description, $synonyms));
}
示例6: __construct
public function __construct($options = null)
{
Zend_Dojo::enableForm($this);
parent::__construct($options);
$category_id = new Zend_Form_Element_Select('category_id');
$category_id->addMultiOption('', 'Select...');
$category_id->setAttrib('class', 'txt_put')->setLabel('Category Name');
$category_id->setRequired(true)->addValidators(array(array('NotEmpty')))->setDecorators(array('ViewHelper', array('Description', array('tag' => '', 'escape' => false)), 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
$productname = new Zend_Form_Element_Text('productname');
$productname->addValidator(new Zend_Validate_Db_NoRecordExists('ourbank_productdetails', 'productname'));
$productname->setAttrib('class', 'txt_put')->setLabel('Product Name');
$productname->setRequired(true)->addValidators(array(array('NotEmpty')))->setDecorators(array('ViewHelper', array('Description', array('tag' => '', 'escape' => false)), 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
$product_id = new Zend_Form_Element_Hidden('product_id');
$product_id->setAttrib('class', 'txt_put');
$productshortname = new Zend_Form_Element_Text('productshortname');
$productshortname->setAttrib('class', 'txt_put')->setLabel('Product Short Name');
$productshortname->setRequired(true)->addValidators(array(array('NotEmpty')))->setDecorators(array('ViewHelper', array('Description', array('tag' => '', 'escape' => false)), 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
$product_description = new Zend_Form_Element_Textarea('product_description', array('rows' => 3, 'cols' => 20));
$product_description->setAttrib('class', '')->setLabel('Productdescription');
$product_description->setRequired(true)->addValidators(array(array('NotEmpty')))->setDecorators(array('ViewHelper', array('Description', array('tag' => '', 'escape' => false)), 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
$submit = new Zend_Form_Element_Submit('Submit');
$submit->setAttrib('id', 'save')->setDecorators(array('ViewHelper', array('Description', array('tag' => '', 'escape' => false)), 'Errors', array(array('data' => 'HtmlTag'), array('colspan' => '8 ')), array(array('data' => 'HtmlTag'), array('tag' => 'td ', 'colspan' => '8')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
$this->addElements(array($category_id, $productname, $productshortname, $product_description, $product_id, $submit));
$this->setDecorators(array('FormElements', array(array('data' => 'HtmlTag'), array('tag' => 'table', 'id' => 'hor-minimalist-b')), 'Form'));
}
示例7: init
public function init()
{
$name = new Zend_Form_Element_Text('name');
$name->setLabel('Name');
$name->setRequired(true);
$this->addElement($name);
$enabled = new Zend_Form_Element_Checkbox('enabled');
$enabled->setLabel('Is the action enabled ?');
$this->addElement($enabled);
$public = new Zend_Form_Element_Checkbox('public');
$public->setLabel('Is the action public ?');
$this->addElement($public);
$use_custom_route = new Zend_Form_Element_Checkbox('use_custom_route');
$use_custom_route->setLabel('Custom Route');
$this->addElement($use_custom_route);
$custom_route = new Zend_Form_Element_Text('route');
//$custom_route->setLabel('Custom Route');
$this->addElement($custom_route);
$desc = new Zend_Form_Element_Textarea('description');
$desc->cols = 40;
$desc->rows = 15;
$desc->setLabel('Description');
$desc->setRequired(false);
$this->addElement($desc);
parent::init();
}
示例8: __construct
public function __construct($options = null)
{
Zend_Dojo::enableForm($this);
parent::__construct($options);
$app = APPLICATION_PATH;
$accountHeader = new Zend_Form_Element_Text('accountHeader');
$accountHeader->setAttrib('class', 'txt_put');
$accountHeader->setAttrib('id', 'accountHeader');
$accountHeader->setRequired(true)->addValidators(array(array('NotEmpty')));
$glcodeDescription = new Zend_Form_Element_Textarea('glcodeDescription', array('rows' => 3, 'cols' => 25));
$glcodeDescription->setAttrib('id', 'glcodeDescription');
$glcodeDescription->setRequired(true)->addValidators(array(array('NotEmpty')));
$product = new Zend_Form_Element_Select('product');
$product->setAttrib('select', '-----');
$product->setAttrib('class', 'txt_put');
$product->setRequired(true)->addValidators(array(array('NotEmpty')));
$offerproduct = new Zend_Form_Element_Select('offerproduct');
$offerproduct->setAttrib('select', '-----');
$offerproduct->setAttrib('class', 'txt_put');
$subheader = new Zend_Form_Element_Text('subheader');
$subheader->setAttrib('class', 'txt_put');
$subheader->setAttrib('id', 'subheader');
$glsubaccountdescription = new Zend_Form_Element_Textarea('glsubaccountdescription', array('rows' => 3, 'cols' => 25));
$glsubaccountdescription->setAttrib('id', 'glsubaccountdescription');
$submit = new Zend_Form_Element_Submit('Save');
$submit->setAttrib('id', 'Save');
$submit->setAttrib('class', 'holiday1');
$this->addElements(array($submit, $accountHeader, $glcodeDescription, $subheader, $glsubaccountdescription, $product, $offerproduct));
$glcodeUpdateId = new Zend_Form_Element_Hidden('glcodeUpdateId');
$glsubcodeupdate_id = new Zend_Form_Element_Hidden('glsubcodeupdate_id');
$submit = new Zend_Form_Element_Submit('Submit');
$submit->setAttrib('class', 'holiday');
$this->addElements(array($submit, $glcodeUpdateId, $glsubcodeupdate_id));
}
示例9: init
public function init()
{
$this->setMethod("POST");
$category = new Zend_Form_Element_Text("name");
$category->setRequired();
$category->setLabel("category Name:");
$category->setAttrib("placeholder", "Enter Category Name");
$category->addValidator(new Zend_Validate_Alnum("true"));
$category->setAttrib("class", "form-control");
$category->getDecorator("Label")->setOption("class", "control-label");
$category->getDecorator("Errors")->setOption("class", "alert alert-danger");
$category->getDecorator("Errors")->setOption("role", "alert");
$category->getDecorator("Errors")->setOption("style", " list-style-type:none");
$description = new Zend_Form_Element_Textarea("description");
$description->setLabel('Description:');
$description->setRequired();
$description->setAttrib("rows", "10");
$description->setAttrib("class", "form-control");
$description->getDecorator("Label")->setOption("class", "control-label");
$description->getDecorator("Errors")->setOption("class", "alert alert-danger");
$description->getDecorator("Errors")->setOption("style", " list-style-type:none");
$submit = new Zend_Form_Element_Submit("submit");
$submit->setAttrib("class", "btn btn-xl center-block");
// $submit->setAttrib("class", "btn");
$this->addElements(array($category, $description, $submit));
}
示例10: init
public function init()
{
$tr = Zend_Registry::get('tr');
$http_code = new Zend_Form_Element_Text('http_code');
$http_code->setLabel($tr->_('HTTP_CODE'));
$http_code->setRequired(false);
$this->addElement($http_code);
$name = new Zend_Form_Element_Text('name');
$name->setLabel($tr->_('NAME'));
$name->setRequired(true);
$this->addElement($name);
$msg = new Zend_Form_Element_Textarea('message');
$msg->setLabel($tr->_('ERROR_MESSAGE'));
$msg->setAttribs(array('rows' => 10, 'cols' => 35));
$msg->setRequired(true);
$this->addElement($msg);
/** Maybe next version will have it back.
$action = new Default_Model_Action;
$all = $action->getList();
$actions = new Zend_Form_Element_Multiselect('actions');
$actions->setLabel('Associated Actions with this Error');
$actions->setMultiOptions($all);
$actions->setAttrib('size', 8);
$this->addElement($actions);
*/
$desc = new Zend_Form_Element_Textarea('description');
$desc->cols = 35;
$desc->rows = 15;
$desc->setLabel($tr->_('DESCRIPTION'));
$desc->setRequired(false);
$this->addElement($desc);
$this->addElement(new Zend_Form_Element_Submit($tr->_('SUBMIT')));
parent::init();
}
示例11: myInit
public function myInit()
{
global $mySession;
$db = new Db();
$public_name = "";
$emailid_val = "";
$bio_value = '';
$old_profile_image_value = '';
$qur = $db->runquery("SELECT * FROM " . USERS . " WHERE user_id='" . $mySession->TeeLoggedID . "' ");
if ($qur != "" and count($qur) > 0) {
$public_name = $qur[0]['public_name'];
$emailid_val = $qur[0]['emailid'];
$bio_value = $qur[0]['bio'];
$old_profile_image_value = $qur[0]['profile_image'];
}
$publicname = new Zend_Form_Element_Text('publicname');
$publicname->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Public name is required'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib('class', 'changepasstextbox')->setValue($public_name);
$bio = new Zend_Form_Element_Textarea('bio');
$bio->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Bio is required.'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("class", "changepasstextarea")->setAttrib("style", "height:150px;width:354px;")->setAttrib("maxlength", "300")->setAttrib("placeholder", "Max 300 Characters")->setValue($bio_value);
$profile_image = new Zend_Form_Element_File('profile_image');
$profile_image->setDestination(SITE_ROOT . 'images/profileimages/')->addValidator('Extension', false, 'jpg,jpeg,png,gif')->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("class", "textInput")->setAttrib("style", "width:325px");
$old_profile_image = new Zend_Form_Element_Hidden('old_profile_image');
$old_profile_image->setValue($old_profile_image_value);
$emailid = new Zend_Form_Element_Text('emailid');
$emailid->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Email Id is required'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib('class', 'changepasstextbox')->setValue($emailid_val);
$this->addElements(array($publicname, $emailid, $bio, $profile_image, $old_profile_image));
}
示例12: init
public function init($campid)
{
global $mySession;
$db = new Db();
$title_val = "";
$baseprice_val = "";
$goal_val = "";
$sold_val = "";
$sellingprice_val = "";
$description_val = "";
$camplength_val = "";
$url_val = "";
$launchdate_val = "";
if ($campid != "") {
$qur = $db->runquery("SELECT * FROM " . LAUNCHCAMPAIGN . " WHERE campaign_id='" . $campid . "'");
if ($qur != "" and count($qur) > 0) {
//prd($qur);
$title_val = $qur[0]['title'];
$baseprice_val = $qur[0]['base_price'];
$goal_val = $qur[0]['goal'];
$sold_val = $qur[0]['sold'];
$sellingprice_val = $qur[0]['selling_price'];
$description_val = $qur[0]['description'];
$camplength_val = $qur[0]['campaign_length'];
$url_val = $qur[0]['url'];
$launchdate_val = $qur[0]['launch_date'];
}
}
# FORM ELEMENT:no of tee
# TYPE : text
$baseprice = new Zend_Form_Element_Text('baseprice');
$baseprice->setRequired(true)->setAttrib("class", "mws-textinput required")->setAttrib("readonly", "readonly")->setAttrib("style", "width:50px; height:20px;")->setvalue($baseprice_val);
$sellingprice = new Zend_Form_Element_Text('sellingprice');
$sellingprice->setRequired(true)->setAttrib("class", "mws-textinput required")->setAttrib("readonly", "readonly")->setAttrib("style", "width:50px; height:20px;")->setvalue($sellingprice_val);
# FORM ELEMENT:camptitle
# TYPE : text
$camptitle = new Zend_Form_Element_Text('camptitle');
$camptitle->setRequired(true)->setAttrib("class", "mws-textinput required")->setAttrib("readonly", "readonly")->setAttrib("style", "width:250px; height:30px;")->setvalue($title_val);
# FORM ELEMENT:description
# TYPE : text
$description = new Zend_Form_Element_Textarea('description');
$description->setRequired(true)->setAttrib("class", "mws-textinput required")->setAttrib("readonly", "readonly")->setAttrib("style", "width:450px; height:120px;")->setvalue($description_val);
$goal = new Zend_Form_Element_Text('goal');
$goal->setRequired(true)->setAttrib("class", "mws-textinput required")->setAttrib("readonly", "readonly")->setAttrib("style", "width:50px; height:20px;")->setvalue($goal_val);
$sold = new Zend_Form_Element_Text('sold');
$sold->setRequired(true)->setAttrib("class", "mws-textinput required")->setAttrib("readonly", "readonly")->setAttrib("style", "width:50px; height:20px;")->setvalue($sold_val);
# FORM ELEMENT:url
# TYPE : text
$url = new Zend_Form_Element_Text('url');
$url->setRequired(true)->setAttrib("class", "mws-textinput required")->setAttrib("readonly", "readonly")->setAttrib("style", "width:60px; height:20px;")->setvalue($url_val);
# FORM ELEMENT:url
# TYPE : text
$camplength = new Zend_Form_Element_Text('camplength');
$camplength->setRequired(true)->setAttrib("class", "mws-textinput required")->setAttrib("readonly", "readonly")->setAttrib("style", "width:50px; height:20px;")->setvalue($camplength_val);
# FORM ELEMENT:url
# TYPE : text
$launchdate = new Zend_Form_Element_Text('launchdate');
$launchdate->setRequired(true)->setAttrib("class", "mws-textinput required")->setAttrib("readonly", "readonly")->setAttrib("style", "width:70px; height:20px;")->setvalue($launchdate_val);
$this->addElements(array($sellingprice, $baseprice, $camptitle, $camplength, $launchdate, $url, $description, $sold, $goal));
}
示例13: setForm
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;
}
示例14: init
public function init()
{
$this->setName('add_testimonial');
//$this->setAction('newExpert');
$this->setMethod('Post');
$this->setAttrib('enctype', 'multipart/form-data');
$first_name = new Zend_Form_Element_Text('first_name', array('disableLoadDefaultDecorators' => true));
$first_name->setRequired(true)->setLabel('* First Name:')->setAttrib('id', 'video_title')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib("class", "form-control")->removeDecorator('htmlTag');
$last_name = new Zend_Form_Element_Text('last_name', array('disableLoadDefaultDecorators' => true));
$last_name->setRequired(true)->setLabel('* Last Name:')->setAttrib('id', 'url_video')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib("class", "form-control")->removeDecorator('htmlTag');
$email = new Zend_Form_Element_Text('email', array('disableLoadDefaultDecorators' => true));
$email->setRequired(true)->setLabel('* Email:')->setAttrib('id', 'email')->setAttrib('size', '30')->addFilter('StripTags')->addFilter('StringTrim')->setErrorMessages(array("Write Email"))->addValidator('EmailAddress', true)->setAttrib("class", "form-control")->removeDecorator('htmlTag');
$short_description = new Zend_Form_Element_Textarea('short_description', array('disableLoadDefaultDecorators' => true));
$short_description->setRequired(true)->setAttrib("id", "short_description")->setLabel(' *Testimonial:')->setAttrib("class", "form-control")->setAttrib('ROWS', '5')->setAttrib('COLS', '3')->setErrorMessages(array("Write Description for Testimonial"))->addFilter('StringTrim');
$image1 = new Zend_Form_Element_File('image1');
//$image1->setRequired(true)
$image1->addValidator('Count', false, 1)->addValidator('ImageSize', false, array('minwidth' => 100, 'maxwidth' => 400, 'minheight' => 100, 'maxheight' => 400))->addValidator('Size', false, 1000240000)->setErrorMessages(array("*Upload an image:"))->addValidator('Extension', false, 'jpg,png,gif');
// only JPEG, PNG, and GIFs
$is_featured = new Zend_Form_Element_Checkbox('is_featured', array('disableLoadDefaultDecorators' => true));
$is_featured->setAttrib("id", "is_featured")->setLabel('Featured:')->setAttrib("class", "form-control")->addFilter('StripTags')->addFilter('StringTrim');
$submit = new Zend_Form_Element_Submit('submit');
$submit->setAttrib('id', 'submitbutton');
$submit->setAttrib('class', 'btn btn-lg btn-primary float-right')->removeDecorator('HtmlTag')->removeDecorator('Label')->setLabel("Save");
$this->setElementDecorators(array('Errors', 'ViewHelper', array('decorator' => array('td' => 'HtmlTag'), 'options' => array('tag' => 'td')), array('Label', array('tag' => 'td')), array('decorator' => array('tr' => 'HtmlTag'), 'options' => array('tag' => 'tr'))), array('first_name', 'last_name', 'email', 'short_description', 'image1', 'is_featured'));
//$this->addElement('hash', 'csrf', array('ignore' => true,));
$this->addElements(array($first_name, $last_name, $image1, $email, $is_featured, $short_description, $submit));
}
示例15: init
public function init()
{
/**
* projeto_id
*/
$modelProjeto = new Model_DbTable_Projeto();
$projeto_id = new Zend_Form_Element_Select("projeto_id");
$projeto_id->setLabel("Projeto: ");
$projeto_id->setAttribs(array('class' => 'form-control'));
$projeto_id->setMultiOptions($modelProjeto->fetchPairs());
$this->addElement($projeto_id);
/**
* tarefa_nome
*/
$tarefa_nome = new Zend_Form_Element_Text("tarefa_nome");
$tarefa_nome->setLabel("Título: ");
$tarefa_nome->setAttribs(array('class' => 'form-control'));
$tarefa_nome->setRequired();
$this->addElement($tarefa_nome);
/**
* tarefa_descricao
*/
$tarefa_descricao = new Zend_Form_Element_Textarea("tarefa_descricao");
$tarefa_descricao->setLabel("Descrição: ");
$tarefa_descricao->setAttribs(array('class' => 'form-control', 'rows' => 10));
$tarefa_descricao->setRequired();
$this->addElement($tarefa_descricao);
parent::init();
}