本文整理汇总了PHP中Zend_Form_Element_Text::addFilter方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form_Element_Text::addFilter方法的具体用法?PHP Zend_Form_Element_Text::addFilter怎么用?PHP Zend_Form_Element_Text::addFilter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Form_Element_Text
的用法示例。
在下文中一共展示了Zend_Form_Element_Text::addFilter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public function init()
{
$this->setMethod('post');
$this->setAttrib('id', 'agencylistreport');
$this->setAttrib('name', 'agencylistreport');
$this->setAttrib('action', DOMAIN . 'reports/agencylistreport');
$agencyname = new Zend_Form_Element_Text('agencynamef');
$agencyname->setLabel('Agency');
$agencyname->setAttrib('onblur', 'clearagencyname(this)');
$agencyname->setAttrib('maxLength', 50);
$primaryphone = new Zend_Form_Element_Text('primaryphonef');
$primaryphone->setLabel('Primary Phone');
$primaryphone->setAttrib('onblur', 'blurelement(this)');
$primaryphone->setAttrib('maxLength', 15);
$primaryphone->addFilter(new Zend_Filter_StringTrim());
$primaryphone->addValidators(array(array('StringLength', false, array('min' => 10, 'max' => 15, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Primary phone number must contain at most %max% characters', Zend_Validate_StringLength::TOO_SHORT => 'Primary phone number must contain at least %min% characters.')))));
$primaryphone->addValidator("regex", true, array('pattern' => '/^(?!0{10})[0-9]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid phone number.')));
$checktype = new Zend_Form_Element_Multiselect('bg_checktypef');
$checktype->setLabel('Screening Type');
$checktypeModal = new Default_Model_Bgscreeningtype();
$typesData = $checktypeModal->fetchAll('isactive=1', 'type');
foreach ($typesData->toArray() as $data) {
$checktype->addMultiOption($data['id'], $data['type']);
}
$checktype->setRegisterInArrayValidator(false);
$checktype->setAttrib('onchange', 'changeelement(this)');
$website = new Zend_Form_Element_Text('website_urlf');
$website->setLabel('Website Url');
$website->setAttrib('maxLength', 50);
$website->addFilter(new Zend_Filter_StringTrim());
$website->setAttrib('onblur', 'clearagencyname(this)');
$this->addElements(array($agencyname, $primaryphone, $checktype, $website));
$this->setElementDecorators(array('ViewHelper'));
}
示例2: 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'));
}
示例3: init
public function init()
{
$this->setMethod('post');
// $this->setAction('/index/login');
$this->setAttrib('id', 'msform');
$email = new Zend_Form_Element_Text('email');
$email->setAttrib('placeholder', 'E-mail');
$email->setAttrib('autocomplete', 'off');
$email->addFilter('StripTags');
$email->addFilter('HtmlEntities');
$email->addFilter('StringTrim');
$email->setRequired(true)->addErrorMessage('Username Required');
$email->addValidator('EmailAddress')->addErrorMessage('Invalid Email used');
$email->addValidator('StringLength', true, array(0, 255))->addErrorMessage('Required Field');
$password = new Zend_Form_Element_Password('password');
$password->setAttrib('placeholder', 'Password');
$password->setAttrib('autocomplete', 'off');
$password->addFilter('StripTags');
$password->addFilter('HtmlEntities');
$password->addFilter('StringTrim');
$password->setRequired(true)->addErrorMessage('Password Required');
$password->addValidator('StringLength', true, array(0, 255))->addErrorMessage('Required Field');
$link = new Zend_Form_Element_Note('forgot_password', array('value' => '<a href="#" id="link">Forgot your password ?</a>'));
$submit = new Zend_Form_Element_Submit('SignIn');
$submit->setLabel('Sign In');
$submit->setAttrib('class', 'btn btn-info');
$register = new Zend_Form_Element_Button('register');
$register->setLabel('Register');
$register->setAttrib('class', 'btn btn-warning');
$this->addElements(array($email, $password, $submit, $register, $link));
$this->setElementDecorators(array('ViewHelper'));
$submit->setDecorators(array('ViewHelper'));
$register->setDecorators(array('ViewHelper'));
$this->setDecorators(array('FormElements', 'Form'));
}
示例4: init
public function init()
{
$this->setMethod('post');
$this->setAction(DOMAIN . 'index/editforgotpassword');
$this->setAttrib('id', 'formid');
$this->setAttrib('name', 'forgotpassword');
$id = new Zend_Form_Element_Hidden('id');
$username = new Zend_Form_Element_Text('emailaddress');
$username->setAttrib('class', 'email-status');
$username->setLabel('Email Address:');
$username->setRequired(true);
$username->addFilter('StripTags');
$username->addFilter('StringTrim');
$username->addValidator('NotEmpty', false, array('messages' => 'Please enter email.'));
$username->addValidator('EmailAddress');
$submit = new Zend_Form_Element_Submit('submit');
$submit->setAttrib('id', 'submitbutton');
$submit->setLabel('SEND');
$url = "'default/index/editforgotpassword/format/json'";
$dialogMsg = "''";
$toggleDivId = "''";
$jsFunction = "''";
$submit->setOptions(array('onclick' => "saveDetails({$url},{$dialogMsg},{$toggleDivId},{$jsFunction});"));
$this->addElements(array($id, $username, $submit));
$this->setElementDecorators(array('ViewHelper'));
}
示例5: init
public function init()
{
$this->setMethod('post');
$this->setAction('/main/new');
$this->setAttrib('id', 'newRoute');
$note = new Zend_Form_Element_Note('title', array('value' => '<h2 id="titleProductDetails">Create a New Route</h2>'));
$intermed = new Zend_Form_Element_Hidden('intermed');
$intermed->setAttrib('readonly', 'readonly');
$intermed->addFilter('StripTags');
$intermed->addFilter('HtmlEntities');
$intermed->addFilter('StringTrim');
$start = new Zend_Form_Element_Text('startForm');
$start->setLabel('Starting Point*');
$start->setAttrib('autocomplete', 'off');
$start->addFilter('StripTags');
$start->addFilter('HtmlEntities');
$start->setAttrib('class', 'form-control');
$start->addFilter('StringTrim');
$start->setRequired(true)->addErrorMessage('Start Location Required');
// $start->addValidator('Regex', true, array('/^[a-zA-Z0-9.,:-\s]*$/'))->addErrorMessage('Invalid characters used');
// $start->addValidator('StringLength', true, array(0, 255))->addErrorMessage('Required Field');
$end = new Zend_Form_Element_Text('endForm');
$end->setLabel('Destination*');
$end->setAttrib('autocomplete', 'off');
$end->addFilter('StripTags');
$end->setAttrib('class', 'form-control');
$end->addFilter('HtmlEntities');
$end->addFilter('StringTrim');
$end->setRequired(true)->addErrorMessage('Destination Required');
// $end->addValidator('StringLength', true, array(0, 255))->addErrorMessage('Required Field');
$routeDate = new Zend_Form_Element_Text('routeDate');
$routeDate->setAttrib('autocomplete', 'off');
$routeDate->setAttrib('readonly', 'readonly');
$routeDate->setAttrib('maxlength', '10');
$routeDate->setAttrib('class', 'form-control');
$routeDate->setLabel('Date of Journey' . '*');
$routeDate->addFilter('StripTags');
$routeDate->addFilter('HtmlEntities');
$routeDate->addFilter('StringTrim');
$routeDate->setRequired(true)->addErrorMessage('Date Required');
$routeDate->addValidator('Regex', true, array('/^[0-9.\\s]*$/'))->addErrorMessage('Invalid characters used');
$routeDate->addValidator('StringLength', true, array(10, 10))->addErrorMessage('Required Field');
$passangers = new Zend_Form_Element_Select('passangers');
$passangers->setLabel('No of Passangers*');
$passangers->setAttrib('autocomplete', 'off');
$passangers->setAttrib('class', 'form-control');
$passangers->addFilter('StripTags');
$passangers->addFilter('HtmlEntities');
$passangers->addFilter('StringTrim');
$passangers->setRequired(true)->addErrorMessage('Password Required');
$passangers->setMultiOptions(array('1' => '1 Passanger', '2' => '2 Passangers', '3' => '3 Passangers', '4' => '4 Passangers', '5' => '5 Passangers', '6' => '6 Passangers'));
$submit = new Zend_Form_Element_Submit('newRoute');
$submit->setLabel('New Route');
$submit->setAttrib('class', 'btn btn-info');
$submit->setAttrib('style', 'margin-top:20px');
$this->addElements(array($note, $intermed, $start, $end, $passangers, $routeDate, $submit));
$this->setElementDecorators(array('ViewHelper', 'Label', 'Errors'));
$submit->setDecorators(array('ViewHelper'));
$this->setDecorators(array('FormElements', 'Form', array('HtmlTag', array('tag' => 'div', 'id' => 'newRouteFormContainer'))));
}
示例6: _nome_caravana
protected function _nome_caravana()
{
$e = new Zend_Form_Element_Text('nome_caravana');
$e->setLabel('* ' . _('Caravan name:'));
$e->setRequired(true);
$e->addValidator('Regex', false, array('/^(\\w|[áéíóúçãõ]|-|\\s)+$/'));
$e->addValidator('StringLength', false, array(1, 100))->addErrorMessage(_("You enter a name too small (min. 1) or the name has invalid characters."));
$e->addFilter('StripTags');
$e->addFilter('StringTrim');
$e->setAttrib('class', 'form-control');
return $e;
}
示例7: init
public function init()
{
$this->setMethod("POST");
$this->setName("createAdAgencyForm");
if (!empty($this->next)) {
$element = new Zend_Form_Element_Hidden("next");
$element->setValue($this->next);
$this->addElement($element);
}
$element = new Zend_Form_Element_Hidden(AdvertisingAgency::CITY);
$element->setValue($this->city->id);
$this->addElement($element);
$element = new Zend_Form_Element_Text(User::NAME);
$element->setLabel('怎么称呼您');
$element->setDescription('必填,中英文都可,2到30个字');
$this->addElement($element);
$element = new Zend_Form_Element_Text(User::EMAIL);
$element->setLabel('您的Email');
$element->setDescription('必填,方便我们联系您');
$element->setRequired(true);
$element->addValidator(new Zend_Validate_EmailAddress());
$element->addValidator('NotEmpty');
$this->addElement($element);
$element = new Zend_Form_Element_Text(User::MOBILE);
$element->setLabel('您的手机号');
$element->addFilter(new Zend_Filter_HtmlEntities());
$element->addFilter(new Zend_Filter_StripTags());
$element->setDescription('方便我们及时联系您');
$this->addElement($element);
$this->addDisplayGroup(array('city_id', 'name', 'email', 'mobile'), 'aboutYou');
$this->getDisplayGroup('aboutYou')->removeDecorator('DtDdWrapper');
$element = new Zend_Form_Element_Textarea(AdvertisingAgency::DESCRIPTION);
$element->setAttrib('rows', 6);
$element->setLabel("有哪些人要入住?基本情况?尽量详细!");
$element->setDescription('如:三口之家,男30岁在爱立信有稳定工作,不吸烟;女27岁在kth读计算机硕士,不吸烟,男孩6岁。整洁,爱干净。');
$element->setRequired(true);
$this->addElement($element);
$element = new Zend_Form_Element_Textarea(AdvertisingAgency::COMMENT);
$element->setAttrib('rows', 6);
$element->setLabel("对房子的要求?最高房租?最小面积?地点?入住时间?");
$element->setDescription('如:最好是一室一厅的整个公寓,也可以与其他人合租。可以合用厨房卫生间。最高房租10000kr每月,最小面积30平米。地点只要是地铁附近,不要离中心太远都可以。入住时间是9月1日,希望能长租。');
$element->setRequired(true);
$this->addElement($element);
$element = new Elements();
$element->addReCaptcha($this);
$element = new Zend_Form_Element_Submit("post");
$this->addElement($element);
$this->addDisplayGroup(array(AdvertisingAgency::DESCRIPTION, AdvertisingAgency::COMMENT, 'challenge', 'post'), 'aboutRoom');
$this->getDisplayGroup('aboutRoom')->removeDecorator('DtDdWrapper');
}
示例8: init
public function init()
{
$this->setDecorators(array(array('ViewScript', array('viewScript' => 'form/add-show-rebroadcast.phtml'))));
$relativeDates = array();
$relativeDates[""] = "";
for ($i = 0; $i <= 30; $i++) {
$relativeDates["{$i} days"] = "+{$i} " . _("days");
}
for ($i = 1; $i <= 10; $i++) {
$select = new Zend_Form_Element_Select("add_show_rebroadcast_date_{$i}");
$select->setAttrib('class', 'input_select');
$select->setMultiOptions($relativeDates);
$select->setRequired(false);
$select->setDecorators(array('ViewHelper'));
$this->addElement($select);
$text = new Zend_Form_Element_Text("add_show_rebroadcast_time_{$i}");
$text->setAttrib('class', 'input_text');
$text->addFilter('StringTrim');
$text->addValidator('date', false, array('HH:mm'));
$text->addValidator('regex', false, array('/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => _('Invalid character entered')));
$text->setRequired(false);
$text->setDecorators(array('ViewHelper'));
$this->addElement($text);
}
}
示例9: init
public function init()
{
parent::init();
$this->setDecorators(array('PrepareElements', array('ViewScript', array('viewScript' => 'form/edit-history-item.phtml'))));
/*
$instance = new Zend_Form_Element_Select("instance_id");
$instance->setLabel(_("Choose Show Instance"));
$instance->setMultiOptions(array("0" => "-----------"));
$instance->setValue(0);
$instance->setDecorators(array('ViewHelper'));
$this->addElement($instance);
*/
$starts = new Zend_Form_Element_Text(self::ID_PREFIX . 'starts');
$starts->setValidators(array(new Zend_Validate_Date(self::VALIDATE_DATETIME_FORMAT)));
$starts->setAttrib('class', self::TEXT_INPUT_CLASS . " datepicker");
$starts->setAttrib('data-format', self::TIMEPICKER_DATETIME_FORMAT);
$starts->addFilter('StringTrim');
$starts->setLabel(_('Start Time'));
$starts->setDecorators(array('ViewHelper'));
$starts->setRequired(true);
$this->addElement($starts);
$ends = new Zend_Form_Element_Text(self::ID_PREFIX . 'ends');
$ends->setValidators(array(new Zend_Validate_Date(self::VALIDATE_DATETIME_FORMAT)));
$ends->setAttrib('class', self::TEXT_INPUT_CLASS . " datepicker");
$ends->setAttrib('data-format', self::TIMEPICKER_DATETIME_FORMAT);
$ends->addFilter('StringTrim');
$ends->setLabel(_('End Time'));
$ends->setDecorators(array('ViewHelper'));
//$ends->setRequired(true);
$this->addElement($ends);
}
示例10: init
public function init()
{
$this->setMethod('post');
$this->setAttrib('action', DOMAIN . 'monthslist/edit');
$this->setAttrib('id', 'formid');
$this->setAttrib('name', 'monthslist');
$id = new Zend_Form_Element_Hidden('id');
$monthname = new Zend_Form_Element_Select('month_id');
$monthname->setAttrib('class', 'selectoption');
$monthname->setRegisterInArrayValidator(false);
$monthname->setRequired(true);
$monthname->addValidator('NotEmpty', false, array('messages' => 'Please select month name.'));
$monthcode = new Zend_Form_Element_Text('monthcode');
$monthcode->setAttrib('maxLength', 20);
$monthcode->addFilter(new Zend_Filter_StringTrim());
$monthcode->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_monthslist', 'field' => 'monthcode', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive=1')));
$monthcode->getValidator('Db_NoRecordExists')->setMessage('Month code 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 = "'monthslist/saveupdate/format/json'";
$dialogMsg = "''";
$toggleDivId = "''";
$jsFunction = "'redirecttocontroller(\\'monthslist\\');'";
$this->addElements(array($id, $monthname, $monthcode, $description, $submit));
$this->setElementDecorators(array('ViewHelper'));
}
示例11: __construct
public function __construct($options = null)
{
parent::__construct($options);
$emailCategoryOptionList = array('Invite non-sparks to join campaign' => $this->getView()->translate('Admin_Non-Sparks_Invitation'), 'Invite sparks to join campaign' => $this->getView()->translate('Admin_Sparks_Invitation'), 'Send mail to sparks' => $this->getView()->translate('Admin_Send_Mail_To_Sparks'));
$emailCategory = new Zend_Form_Element_Select('emailCategory');
$emailCategory->setMultiOptions($emailCategoryOptionList);
$emailList = new Zend_Form_Element_Textarea('emailList');
$emailList->setAttribs(array('rows' => 5, 'cols' => 150, 'onChange' => 'datetable()'))->addFilter('StripTags')->addFilter('StringTrim')->addValidators(array(array('StringLength', false, array(0, 65535))));
$subject = new Zend_Form_Element_Text('subject');
$subject->setAttribs(array('size' => 150))->addFilter('StringTrim');
$message = new Zend_Form_Element_Textarea('message');
$message->setAttribs(array('rows' => 30, 'cols' => 150))->addFilter('StripTags')->addFilter('StringTrim')->addValidators(array(array('StringLength', false, array(0, 65535))));
$optionList = array();
$campaign = new Campaign();
$campaigns = $campaign->fetchAll(null, "id desc", null, null);
foreach ($campaigns as $campaign) {
$optionList[$campaign->id] = $campaign->name;
}
$optionList['0'] = $this->getView()->translate('ADMIN_NOT_AUTO_INVITATION');
$campaignId = new Zend_Form_Element_Select('campaignId');
$campaignId->setMultiOptions($optionList);
$code_source = new Zend_Form_Element_Text('code_source');
$code_source->addFilter('StringTrim');
$submit = new Zend_Form_Element_Submit('submit');
$submit->setLabel($this->getView()->translate('INVITATION_MAIL_SEND'));
$this->addElements(array($emailCategory, $emailList, $subject, $message, $campaignId, $code_source, $submit));
}
示例12: 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'));
}
示例13: init
public function init()
{
$this->setMethod('post');
$this->setAttrib('action', DOMAIN . 'dashboard/viewprofile');
$this->setAttrib('id', 'formid');
$this->setAttrib('name', 'profileview');
$id = new Zend_Form_Element_Hidden('id');
$userfullname = new Zend_Form_Element_Text("userfullname");
$userfullname->setLabel("User Name");
$userfullname->setAttrib("class", "formDataElement");
$userfullname->setAttrib('length', 70);
$userfullname->setRequired(true);
$userfullname->addValidator('NotEmpty', false, array('messages' => 'Please enter user name.'));
$userfullname->addValidator("regex", true, array('pattern' => '/^([a-zA-Z.]+ ?)+$/', 'messages' => array('regexNotMatch' => 'Please enter only alphabets.')));
$emailaddress = new Zend_Form_Element_Text('emailaddress');
$emailaddress->setRequired(true);
$emailaddress->setAttrib('maxLength', 50);
$emailaddress->setLabel("Email");
$emailaddress->addFilter('StripTags');
$emailaddress->addValidator('NotEmpty', false, array('messages' => 'Please enter email.'));
$emailaddress->addValidator("regex", true, array('pattern' => '/^(?!.*\\.{2})[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\\.[a-zA-Z0-9-.]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid email.')));
$emailaddress->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_users', 'field' => 'emailaddress', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '"')));
$emailaddress->getValidator('Db_NoRecordExists')->setMessage('Email already exists.');
$submit = new Zend_Form_Element_Submit('submit');
$submit->setAttrib('id', 'submitbutton');
$submit->setLabel('Save');
$this->addElements(array($id, $userfullname, $emailaddress, $submit));
$this->setElementDecorators(array('ViewHelper'));
}
示例14: init
public function init()
{
$this->setMethod('post');
$this->setAttrib('id', 'formid');
$this->setAttrib('name', 'empleaves');
$id = new Zend_Form_Element_Hidden('id');
$userid = new Zend_Form_Element_Hidden('user_id');
$emp_leave_limit = new Zend_Form_Element_Text('leave_limit');
$emp_leave_limit->setAttrib('maxLength', 3);
$emp_leave_limit->addFilter(new Zend_Filter_StringTrim());
$emp_leave_limit->setRequired(true);
$emp_leave_limit->addValidator('NotEmpty', false, array('messages' => 'Please enter leave limit for current year.'));
$emp_leave_limit->addValidator("regex", true, array('pattern' => '/^(\\-?[1-9]|\\-?[1-9][0-9])$/', 'messages' => array('regexNotMatch' => 'Leave limit must be in the range of 0 to 100.')));
$used_leaves = new Zend_Form_Element_Text('used_leaves');
$used_leaves->setAttrib('maxLength', 3);
$used_leaves->setAttrib('readonly', 'true');
$used_leaves->setAttrib('onfocus', 'this.blur()');
$alloted_year = new Zend_Form_Element_Text('alloted_year');
$alloted_year->setAttrib('maxLength', 4);
$alloted_year->setAttrib('readonly', 'true');
$alloted_year->setAttrib('onfocus', 'this.blur()');
$submit = new Zend_Form_Element_Submit('submit');
$submit->setAttrib('id', 'submitbutton');
$submit->setLabel('Save');
$submitbutton = new Zend_Form_Element_Button('submitbutton');
$submitbutton->setAttrib('id', 'submitbuttons');
$submitbutton->setLabel('Save');
$this->addElements(array($id, $userid, $emp_leave_limit, $used_leaves, $alloted_year, $submit, $submitbutton));
$this->setElementDecorators(array('ViewHelper'));
}
示例15: init
public function init()
{
$this->setMethod('post');
$this->setAttrib('action', BASE_URL . 'militaryservice/edit');
$this->setAttrib('id', 'formid');
$this->setAttrib('name', 'militaryservice');
$id = new Zend_Form_Element_Hidden('id');
$militaryservicetype = new Zend_Form_Element_Text('militaryservicetype');
$militaryservicetype->setAttrib('maxLength', 20);
$militaryservicetype->addFilter(new Zend_Filter_StringTrim());
$militaryservicetype->setRequired(true);
$militaryservicetype->addValidator('NotEmpty', false, array('messages' => 'Please enter military service type.'));
$militaryservicetype->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^(?=.*[a-zA-Z])([^ ][a-zA-Z\\s]*)$/', 'messages' => array('regexNotMatch' => 'Please enter valid military service type.')))));
$militaryservicetype->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_militaryservice', 'field' => 'militaryservicetype', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive=1')));
$militaryservicetype->getValidator('Db_NoRecordExists')->setMessage('Military service type 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, $militaryservicetype, $description, $submit));
$this->setElementDecorators(array('ViewHelper'));
}