本文整理汇总了PHP中Zend_Form_Element_Text::setRequired方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form_Element_Text::setRequired方法的具体用法?PHP Zend_Form_Element_Text::setRequired怎么用?PHP Zend_Form_Element_Text::setRequired使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Form_Element_Text
的用法示例。
在下文中一共展示了Zend_Form_Element_Text::setRequired方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public function init()
{
global $mySession;
$db = new Db();
$ConfigData = $db->runQuery("select * from " . ADMINISTRATOR . " where admin_id='1'");
$SiteTitle = $ConfigData[0]['site_title'];
$MetaDescription = $ConfigData[0]['site_description'];
$MetaKeyword = $ConfigData[0]['site_keyword'];
$AdminEmail = $ConfigData[0]['admin_email'];
$PaypalEmail = $ConfigData[0]['paypal_email'];
$welcomemessageC = $ConfigData[0]['welcomemessage'];
$admin_name_value = $ConfigData[0]['admin_fullname'];
$site_title = new Zend_Form_Element_Text('site_title');
$site_title->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Site title is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($SiteTitle);
$admin_name = new Zend_Form_Element_Text('admin_name');
$admin_name->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Admin name is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($admin_name_value);
$site_description = new Zend_Form_Element_Text('site_description');
$site_description->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Site description is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($MetaDescription);
$site_keyword = new Zend_Form_Element_Text('site_keyword');
$site_keyword->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Site keyword is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($MetaKeyword);
$admin_email = new Zend_Form_Element_Text('admin_email');
$admin_email->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Administrator email is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required email")->setValue($AdminEmail);
$paypal_email = new Zend_Form_Element_Text('paypal_email');
$paypal_email->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Paypal email address is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required email")->setValue($PaypalEmail);
/*$currency_symbol= new Zend_Form_Element_Text('currency_symbol');
$currency_symbol->setRequired(true)
->addValidator('NotEmpty',true,array('messages' =>'Currency symbol is required.'))
->addDecorator('Errors', array('class'=>'error'))
->setAttrib("class","required")
->setValue($CurrencySymbol);*/
$welcomemessage = new Zend_Form_Element_Textarea('welcomemessage');
$welcomemessage->setAttrib("id", "elrte")->setAttrib("cols", "auto")->setAttrib("rows", "auto")->setValue($welcomemessageC);
$this->addElements(array($site_title, $admin_name, $site_description, $site_keyword, $admin_email, $paypal_email, $welcomemessage));
}
示例2: init
public function init()
{
global $mySession;
$db = new Db();
$emailid_val = "";
$qur = $db->runquery("SELECT * FROM " . USERS . " WHERE user_id='" . $mySession->TeeLoggedID . "' ");
//$qur=$db->runquery("select * from ".ADDRESS." join ".STATE." on ".STATE.".state_id=".ADDRESS.".state where user_id='".$mySession->TeeLoggedID."' ");
if ($qur != "" and count($qur) > 0) {
$emailid_val = $qur[0]['emailid'];
}
# FORM ELEMENT:public name
# TYPE : text
$emailid = new Zend_Form_Element_Text('emailid');
$emailid->setRequired(true)->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib('class', 'changeaddress')->setAttrib('readonly', 'readonly')->setAttrib("style", "width:300px; height:30px;")->setValue($emailid_val);
# FORM ELEMENT:address
# TYPE : text
$friendsemailid = new Zend_Form_Element_Text('friendsemailid');
$friendsemailid->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'One id is required'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("style", "width:300px; height:30px;")->setAttrib('class', 'changepasstextbox');
//if(@$_REQUEST['friendsemailid']!="")
// {
// $friendsemailid-> addValidator('EmailAddress', true)
// ->addDecorator('Errors', array('class'=>'errmsg'))
// ->addErrorMessage('Please enter a valid email address');
// }
//
# FORM ELEMENT:city
# TYPE : text
$url = new Zend_Form_Element_Text('url');
$url->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'URL is required'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib('class', 'changeaddress')->setAttrib("style", "width:100px; height:30px;");
$this->addElements(array($emailid, $friendsemailid, $url));
}
示例3: init
public function init()
{
$this->setMethod('post');
$this->setAttrib('id', 'formid');
$this->setAttrib('name', 'holidaygroups');
$id = new Zend_Form_Element_Hidden('id');
$holidayname = new Zend_Form_Element_Text('holidayname');
$holidayname->setAttrib('maxLength', 20);
$holidayname->addFilter(new Zend_Filter_StringTrim());
$holidayname->setRequired(true);
$holidayname->addValidator('NotEmpty', false, array('messages' => 'Please enter holiday.'));
$holidayname->addValidator("regex", true, array('pattern' => '/^[a-zA-Z0-9.\\- ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid holiday.')));
$groupid = new Zend_Form_Element_Multiselect('groupid');
$groupid->setAttrib('class', 'selectoption');
$groupid->setRegisterInArrayValidator(false);
$groupid->setRequired(true);
$groupid->addValidator('NotEmpty', false, array('messages' => 'Please select holiday group.'));
$holiday_date = new ZendX_JQuery_Form_Element_DatePicker('holidaydate');
$holiday_date->setAttrib('readonly', 'true');
$holiday_date->setAttrib('onfocus', 'this.blur()');
$holiday_date->setOptions(array('class' => 'brdr_none'));
$holiday_date->setRequired(true);
$holiday_date->addValidator('NotEmpty', false, array('messages' => 'Please select date.'));
$description = new Zend_Form_Element_Textarea('description');
$description->setAttrib('rows', 10);
$description->setAttrib('cols', 50);
$description->setAttrib('maxlength', '200');
$submit = new Zend_Form_Element_Submit('submit');
$submit->setAttrib('id', 'submitbutton');
$submit->setLabel('Save');
$this->addElements(array($id, $holidayname, $groupid, $holiday_date, $description, $submit));
$this->setElementDecorators(array('ViewHelper'));
$this->setElementDecorators(array('UiWidgetElement'), array('holidaydate'));
}
示例4: __construct
/**
* @author code generate
* @return mixed
*/
public function __construct($option = array())
{
$classId = new Zend_Form_Element_Hidden('UserId');
$classId->setDecorators(array('ViewHelper'));
$this->addElement($classId);
$email = new Zend_Form_Element_Text('Email');
$email->setLabel('Email *');
$email->addFilter('StringTrim');
$email->setRequired(true);
$email->setDecorators(array('ViewHelper', array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control')), array('Label', array('class' => 'col-lg-2 control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group'))));
$email->addValidator(new Zend_Validate_Db_NoRecordExists("Users", "Email"));
$email->addValidator('EmailAddress', true);
$email->setRequired(true)->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => "Email không phù hợp")));
$this->addElement($email);
$save = new Zend_Form_Element_Submit('Save');
$save->setLabel('Đăng ký');
$save->setAttrib('class', 'btn btn-primary');
$save->setDecorators(array('ViewHelper'));
$this->addElement($save);
$reset = new Zend_Form_Element_Reset('Reset');
$reset->setLabel('Làm lại');
$reset->setAttrib('class', 'btn btn-primary');
$reset->setDecorators(array('ViewHelper'));
$this->addElement($reset);
}
示例5: __construct
public function __construct()
{
$transactionType = new Zend_Form_Element_Select('transactionType');
$transactionType->setAttrib('class', 'NormalBtn');
$transactionType->setRequired(true)->addValidators(array(array('NotEmpty')));
$transactionMode = new Zend_Form_Element_Select('transactionMode');
$transactionMode->setAttrib('class', 'NormalBtn');
$transactionMode->setRequired(true);
// ->addValidators(array(array('NotEmpty')));
$transactionMode->setAttrib('onchange', 'display(this.value);');
$transaction_interest_amount = new Zend_Form_Element_Text('transaction_interest_amount');
$transaction_interest_amount->setAttrib('class', 'NormalBtn');
$transaction_fine_amount = new Zend_Form_Element_Text('transaction_fine_amount');
$transaction_fine_amount->setAttrib('class', 'NormalBtn');
$account_id = new Zend_Form_Element_Text('account_id');
$account_id->setAttrib('class', 'NormalBtn');
$transaction_date = new Zend_Form_Element_Text('transaction_date');
$transaction_date->setAttrib('class', 'NormalBtn');
$transaction_date->setRequired(true)->addValidators(array(array('NotEmpty')));
$transaction_date->setRequired(true)->addValidator(new Zend_Validate_Date('YYYY-MM-DD'), true, array('messages' => array(Zend_Validate_Date::FALSEFORMAT => 'Enter the valid date')));
$transaction_amount = new Zend_Form_Element_Text('transaction_amount');
$transaction_amount->setAttrib('class', 'NormalBtn');
$transaction_remarks = new Zend_Form_Element_Textarea('transaction_remarks', array('rows' => 3, 'cols' => 15));
$transaction_remarks->setAttrib('class', 'NormalBtn');
$transaction_remarks->setRequired(true)->addValidators(array(array('NotEmpty')));
$submit = new Zend_Form_Element_Submit('submit');
$submit->setAttrib('id', 'submit');
$submit->setAttrib('class', 'NormalBtn');
$submit->setLabel('submit');
$this->addElements(array($transactionType, $transactionMode, $transaction_interest_amount, $transaction_fine_amount, $account_id, $transaction_date, $transaction_amount, $transaction_remarks, $submit));
}
示例6: init
public function init()
{
$this->setMethod('post');
$this->setAttrib('action', BASE_URL . 'veteranstatus/edit');
$this->setAttrib('id', 'formid');
$this->setAttrib('name', 'veteranstatus');
$id = new Zend_Form_Element_Hidden('id');
$veteranstatus = new Zend_Form_Element_Text('veteranstatus');
$veteranstatus->setAttrib('maxLength', 20);
$veteranstatus->setRequired(true);
$veteranstatus->addValidator('NotEmpty', false, array('messages' => 'Please enter veteran status.'));
$veteranstatus->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^(?=.*[a-zA-Z])([^ ][a-zA-Z\\s]*)$/', 'messages' => array('regexNotMatch' => 'Please enter valid veteran status.')))));
$veteranstatus->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_veteranstatus', 'field' => 'veteranstatus', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive=1')));
$veteranstatus->getValidator('Db_NoRecordExists')->setMessage('Veteran status already exists.');
$description = new Zend_Form_Element_Textarea('description');
$description->setAttrib('rows', 10);
$description->setAttrib('cols', 50);
$description->setAttrib('maxlength', '200');
$submit = new Zend_Form_Element_Submit('submit');
$submit->setAttrib('id', 'submitbutton');
$submit->setLabel('Save');
$url = "'gender/saveupdate/format/json'";
$dialogMsg = "''";
$toggleDivId = "''";
$jsFunction = "'redirecttocontroller(\\'gender\\');'";
$this->addElements(array($id, $veteranstatus, $description, $submit));
$this->setElementDecorators(array('ViewHelper'));
}
示例7: init
public function init()
{
$this->setDecorators(array(array('ViewScript', array('viewScript' => 'form/daterange.phtml'))));
// Add start date element
$startDate = new Zend_Form_Element_Text('his_date_start');
$startDate->class = 'input_text';
$startDate->setRequired(true)->setLabel('Date Start:')->setValue(date("Y-m-d"))->setFilters(array('StringTrim'))->setValidators(array('NotEmpty', array('date', false, array('YYYY-MM-DD'))))->setDecorators(array('ViewHelper'));
$startDate->setAttrib('alt', 'date');
$this->addElement($startDate);
// Add start time element
$startTime = new Zend_Form_Element_Text('his_time_start');
$startTime->class = 'input_text';
$startTime->setRequired(true)->setValue('00:00')->setFilters(array('StringTrim'))->setValidators(array('NotEmpty', array('date', false, array('HH:mm')), array('regex', false, array('/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => 'Invalid character entered'))))->setDecorators(array('ViewHelper'));
$startTime->setAttrib('alt', 'time');
$this->addElement($startTime);
// Add end date element
$endDate = new Zend_Form_Element_Text('his_date_end');
$endDate->class = 'input_text';
$endDate->setRequired(true)->setLabel('Date End:')->setValue(date("Y-m-d"))->setFilters(array('StringTrim'))->setValidators(array('NotEmpty', array('date', false, array('YYYY-MM-DD'))))->setDecorators(array('ViewHelper'));
$endDate->setAttrib('alt', 'date');
$this->addElement($endDate);
// Add end time element
$endTime = new Zend_Form_Element_Text('his_time_end');
$endTime->class = 'input_text';
$endTime->setRequired(true)->setValue('01:00')->setFilters(array('StringTrim'))->setValidators(array('NotEmpty', array('date', false, array('HH:mm')), array('regex', false, array('/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => 'Invalid character entered'))))->setDecorators(array('ViewHelper'));
$endTime->setAttrib('alt', 'time');
$this->addElement($endTime);
}
示例8: init
public function init()
{
$this->setMethod('post');
//$this->setAttrib('action',DOMAIN.'language/edit');
$this->setAttrib('id', 'formid');
$this->setAttrib('name', 'servicedeskdepartment');
$id = new Zend_Form_Element_Hidden('id');
$servicedeskdepartment = new Zend_Form_Element_Text("service_desk_name");
$servicedeskdepartment->setLabel("Category");
$servicedeskdepartment->setAttrib('maxLength', 30);
$servicedeskdepartment->addFilter(new Zend_Filter_StringTrim());
$servicedeskdepartment->setRequired(true);
$servicedeskdepartment->addValidator('NotEmpty', false, array('messages' => 'Please enter category.'));
$servicedeskdepartment->addValidator("regex", true, array('pattern' => '/^[a-zA-Z0-9\\- ]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid category.')));
$servicedeskdepartment->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_sd_depts', 'field' => 'service_desk_name', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" AND isactive=1')));
$servicedeskdepartment->getValidator('Db_NoRecordExists')->setMessage('Category name already exists.');
$description = new Zend_Form_Element_Textarea('description');
$description->setLabel("Description");
$description->setAttrib('rows', 10);
$description->setAttrib('cols', 50);
$description->setAttrib('maxlength', '200');
$submit = new Zend_Form_Element_Submit('submit');
$submit->setAttrib('id', 'submitbutton');
$submit->setLabel('Save');
$this->addElements(array($id, $servicedeskdepartment, $description, $submit));
$this->setElementDecorators(array('ViewHelper'));
}
示例9: init
public function init()
{
$this->setMethod('post');
$this->setAttrib('action', BASE_URL . 'timeformat/edit');
$this->setAttrib('id', 'formid');
$this->setAttrib('name', 'timeformat');
$id = new Zend_Form_Element_Hidden('id');
$timeformat = new Zend_Form_Element_Text('timeformat');
$timeformat->setAttrib('maxLength', 20);
$timeformat->addFilter(new Zend_Filter_StringTrim());
$timeformat->setRequired(true);
$timeformat->addValidator('NotEmpty', false, array('messages' => 'Please enter time format.'));
$description = new Zend_Form_Element_Textarea('description');
$description->setAttrib('rows', 10);
$description->setAttrib('cols', 50);
$description->setAttrib('maxlength', '200');
$submit = new Zend_Form_Element_Submit('submit');
$submit->setAttrib('id', 'submitbutton');
$submit->setLabel('Save');
$url = "'timeformat/saveupdate/format/json'";
$dialogMsg = "''";
$toggleDivId = "''";
$jsFunction = "'redirecttocontroller(\\'timeformat\\');'";
$this->addElements(array($id, $timeformat, $description, $submit));
$this->setElementDecorators(array('ViewHelper'));
}
示例10: init
public function init()
{
$this->setAction(URL_BASE . '/action');
$tr = Zend_Registry::get('tr');
$name = new Zend_Form_Element_Text('name');
$name->setLabel($tr->_('NAME'));
$name->setRequired(true);
$name->addValidator('NotEmpty', true, array('messages' => $tr->_('GENERAL_MISSING_TEXT_VALUE')));
$this->addElement($name);
$enabled = new Zend_Form_Element_Checkbox('enabled');
$enabled->setLabel($tr->_('IS_ACTION_ENABLED'));
$this->addElement($enabled);
$public = new Zend_Form_Element_Checkbox('public');
$public->setLabel($tr->_('IS_ACTION_PUBLIC'));
$this->addElement($public);
$route = new Zend_Form_Element_Text('route');
$route->setLabel($tr->_('CUSTOM_ROUTE'));
$route->setRequired(true);
$route->addValidator('NotEmpty', true, array('messages' => $tr->_('GENERAL_MISSING_TEXT_VALUE')));
$this->addElement($route);
$desc = new Zend_Form_Element_Textarea('description');
$desc->cols = 35;
$desc->rows = 15;
$desc->setLabel($tr->_('DESCRIPTION'));
$desc->setRequired(false);
$this->addElement($desc);
parent::init();
}
示例11: init
public function init()
{
$this->setMethod('post');
//$this->setAttrib('action',DOMAIN.'language/edit');
$this->setAttrib('id', 'formid');
$this->setAttrib('name', 'appraisalratings');
// echo "ratings:".$appraisal_rating; die;
$id = new Zend_Form_Element_Hidden('id');
$postid = Zend_Controller_Front::getInstance()->getRequest()->getParam('id');
$rating_value = new Zend_Form_Element_Text("Rating Value");
//$rating_value->setAttrib('onchange', 'buildDiv(this)');
$rating_value->setLabel("Rating Value");
$rating_value->setAttrib('maxLength', 30);
$rating_value->addFilter(new Zend_Filter_StringTrim());
$rating_value->setRequired(true);
$rating_value->addValidator('NotEmpty', false, array('messages' => 'Please enter rating value.'));
$rating_value->addValidator("regex", true, array('pattern' => '/^[a-zA-Z0-9\\- ]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid rating value.')));
$rating_text = new Zend_Form_Element_Text("Rating Text");
$rating_text->setLabel("Rating Text");
$rating_text->setAttrib('maxLength', 30);
$rating_text->addFilter(new Zend_Filter_StringTrim());
$rating_text->setRequired(true);
$rating_text->addValidator('NotEmpty', false, array('messages' => 'Please enter rating text.'));
$rating_text->addValidator("regex", true, array('pattern' => '/^[a-zA-Z0-9.\\- ?\',\\/#@$&*()!]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid rating text.')));
$submit = new Zend_Form_Element_Submit('submit');
$submit->setAttrib('id', 'submitbutton');
$submit->setLabel('Save');
$this->addElements(array($id, $rating_value, $rating_text, $submit));
$this->setElementDecorators(array('ViewHelper'));
}
示例12: init
public function init()
{
// Add start date element
$startDate = new Zend_Form_Element_Text('add_show_start_date');
$startDate->class = 'input_text';
$startDate->setRequired(true)->setLabel('Date/Time Start:')->setValue(date("Y-m-d"))->setFilters(array('StringTrim'))->setValidators(array('NotEmpty', array('date', false, array('YYYY-MM-DD'))))->setDecorators(array(array(array('open' => 'HtmlTag'), array('tag' => 'dd', 'openOnly' => true)), 'ViewHelper', 'Description', array('Label', array('tag' => 'dt'))));
$this->addElement($startDate);
// Add start time element
$startTime = new Zend_Form_Element_Text('add_show_start_time');
$startTime->class = 'input_text';
$startTime->setRequired(true)->setValue('00:00')->setFilters(array('StringTrim'))->setValidators(array('NotEmpty', array('date', false, array('HH:mm')), array('regex', false, array('/^[0-9:]+$/', 'messages' => 'Invalid character entered'))))->setDecorators(array('ViewHelper', 'Errors', array(array('close' => 'HtmlTag'), array('tag' => 'dd', 'closeOnly' => true))));
$this->addElement($startTime);
// Add end date element
$endDate = new Zend_Form_Element_Text('add_show_end_date_no_repeat');
$endDate->class = 'input_text';
$endDate->setRequired(true)->setLabel('Date/Time End:')->setValue(date("Y-m-d"))->setFilters(array('StringTrim'))->setValidators(array('NotEmpty', array('date', false, array('YYYY-MM-DD'))))->setDecorators(array(array(array('open' => 'HtmlTag'), array('tag' => 'dd', 'openOnly' => true)), 'ViewHelper', 'Description', array('Label', array('tag' => 'dt'))));
$this->addElement($endDate);
// Add end time element
$endTime = new Zend_Form_Element_Text('add_show_end_time');
$endTime->class = 'input_text';
$endTime->setRequired(true)->setValue('01:00')->setFilters(array('StringTrim'))->setValidators(array('NotEmpty', array('date', false, array('HH:mm')), array('regex', false, array('/^[0-9:]+$/', 'messages' => 'Invalid character entered'))))->setDecorators(array('ViewHelper', 'Errors', array(array('close' => 'HtmlTag'), array('tag' => 'dd', 'closeOnly' => true))));
$this->addElement($endTime);
// Add duration element
$this->addElement('text', 'add_show_duration', array('label' => 'Duration:', 'class' => 'input_text', 'value' => '01h00m', 'readonly' => true));
// Add repeats element
$this->addElement('checkbox', 'add_show_repeats', array('label' => 'Repeats?', 'required' => false));
}
示例13: init
public function init()
{
$this->setMethod('post');
$this->setAttrib('id', 'pdcategories');
$this->setAttrib('name', 'pdcategories');
$categoryName = new Zend_Form_Element_Text('category');
$categoryName->setAttrib('id', 'category');
$categoryName->setAttrib('name', 'category');
$categoryName->setAttrib('maxlength', '30');
$categoryName->setAttrib('onblur', 'chkCategory()');
$categoryName->setAttrib('onkeypress', 'chkCategory()');
$categoryName->addFilter(new Zend_Filter_StringTrim());
$categoryName->setRequired(true);
$categoryName->addValidator('NotEmpty', false, array("messages" => 'Please enter category'));
$categoryName->addValidator('regex', true, array('pattern' => '/^[a-zA-Z0-9][\\s+[a-zA-Z0-9]+]*$/', 'messages' => array('regexNotMatch' => 'Please enter valid category')));
$categoryName->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_pd_categories', 'field' => 'category', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive = 1')));
$categoryName->getValidator('Db_NoRecordExists')->setMessage('Category already exists');
$categoryDesc = new Zend_Form_Element_Textarea('description');
$categoryDesc->setAttrib('id', 'description');
$categoryDesc->setAttrib('name', 'description');
$categoryDesc->setAttrib('rows', 10);
$categoryDesc->setAttrib('cols', 50);
$categoryDesc->setAttrib('maxlength', 250);
$submitBtn = new Zend_Form_Element_Submit('submit');
$submitBtn->setAttrib('id', 'submitBtn');
$submitBtn->setLabel('Add');
$this->addElements(array($categoryName, $categoryDesc, $submitBtn));
$this->setElementDecorators(array('ViewHelper'));
}
示例14: _setupElements
private function _setupElements()
{
$translate = Zend_Registry::get('Zend_Translate');
$this->setAttrib('id', 'signupForm');
$this->setTranslator($translate);
$email = new Zend_Form_Element_Text('email');
$email->setRequired(true)->addFilter('StringTrim')->addFilter('StripTags')->addValidator('NotEmpty')->removeDecorator('HtmlTag')->removeDecorator('DtDWrapper')->removeDecorator('label')->setAttrib('id', 'email')->addValidator('EmailAddress');
$email->addValidator(new Ziown_Form_Validate_EmailAddress(), false);
$email->getValidator('NotEmpty')->setMessage('Email Address is Required', 'isEmpty');
$username = new Zend_Form_Element_Text('username');
$username->setRequired(true)->addFilter('StringTrim')->addFilter('StripTags')->addValidator('NotEmpty')->removeDecorator('HtmlTag')->removeDecorator('DtDWrapper')->removeDecorator('label')->setAttrib('id', 'username');
$username->addValidator(new Ziown_Form_Validate_UserName());
$username->getValidator('NotEmpty')->setMessage('User name is Required', 'isEmpty');
$password = new Zend_Form_Element_Password('password');
$password->setRequired(true)->removeDecorator('HtmlTag')->removeDecorator('DtDWrapper')->removeDecorator('label')->setAttrib('id', 'txt-password')->setErrorMessages(array('Password is required'));
$identValidator = new Zend_Validate_Identical($_POST['password']);
$identValidator->setMessages(array('notSame' => 'Password doesn\'t match!', 'missingToken' => 'Password doesn\'t match!'));
$confirm_password = new Zend_Form_Element_Password('confirm_password');
$confirm_password->setRequired(true)->removeDecorator('HtmlTag')->removeDecorator('DtDWrapper')->removeDecorator('label')->setAttrib('id', 'txt-confirm-password')->addValidator($identValidator);
$signup = new Zend_Form_Element_Submit('signup');
$signup->setLabel('Sign Up');
$signup->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->setAttrib('class', 'u-login');
$this->setDecorators(array(array('ViewScript', array('script' => 'signup.phtml'))));
$this->addElements(array($username, $password, $confirm_password, $signup, $email));
}
示例15: init
public function init()
{
// Set form options
$this->setName('userShippingAddress')->setMethod('post');
// Address One
$addressOne = new Zend_Form_Element_Text('addressOne');
$addressOne->setRequired(true);
// Address One
$addressTwo = new Zend_Form_Element_Text('addressTwo');
$addressTwo->setRequired(false);
// City
$city = new Zend_Form_Element_Text('city');
$city->setRequired(true);
// State
$state = new Zend_Form_Element_Text('state');
$state->setRequired(true);
// Country
$country = new Zend_Form_Element_Text('country');
$country->setRequired(true);
// ZIP
$zip = new Zend_Form_Element_Text('zip');
$zip->setRequired(true);
// Is Default Shipping?
$defaultShipping = new Zend_Form_Element_Checkbox('defaultShipping');
$defaultShipping->setRequired(false);
// Add all the elements to the form
$this->addElement($addressOne)->addElement($addressTwo)->addElement($city)->addElement($state)->addElement($country)->addElement($zip)->addElement($defaultShipping);
}