当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Form_Element_Select::addValidators方法代码示例

本文整理汇总了PHP中Zend_Form_Element_Select::addValidators方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form_Element_Select::addValidators方法的具体用法?PHP Zend_Form_Element_Select::addValidators怎么用?PHP Zend_Form_Element_Select::addValidators使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Form_Element_Select的用法示例。


在下文中一共展示了Zend_Form_Element_Select::addValidators方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 public function __construct($path)
 {
     parent::__construct($path);
     $formfield = new App_Form_Field();
     // 	$fieldtype,$fieldname,$table,$columnname,$cssname,$labelname,$required,$validationtype,$min,$max,$decorator,$value
     $meeting_name = $formfield->field('Text', 'meeting_name', '', '', 'mand', '', true, '', '', '', '', '', '', '');
     $meeting_name->addValidator('Alnum', true, array('allowWhiteSpace' => true));
     $group_head = $formfield->field('Text', 'group_head', '', '', 'mand', '', '', '', '', '', '', '', '', '');
     $group_head->setAttrib('readonly', 'readonly');
     $hiddenId = new Zend_Form_Element_Hidden('group_head_id');
     $meeting_place = $formfield->field('Text', 'meeting_place', '', '', 'mand', '', true, '', '', '', '', '', '', '');
     $meeting_place->addValidator('Alnum', true, array('allowWhiteSpace' => true));
     $meeting_time = $formfield->field('Text', 'meeting_time', '', '', 'mand', '', true, '', '', '', '', '', '', '');
     $institute_bank_id = new Zend_Form_Element_Select('institute_bank_id');
     $institute_bank_id->addMultiOption('', 'Select...');
     $institute_bank_id->setAttrib('class', 'txt_put');
     $institute_bank_id->setAttrib('onchange', 'getGroups(this.value,"' . $path . '")');
     $institute_bank_id->addValidators(array(array('NotEmpty')));
     $group_name = new Zend_Form_Element_Select('group_name');
     $group_name->addMultiOption('', 'Select...');
     $group_name->setAttrib('class', 'txt_put');
     $group_name->setAttrib('onchange', 'getHeadName(this.value,"' . $path . '")');
     $group_name->setRequired(true)->setRegisterInArrayValidator(false)->addValidators(array(array('NotEmpty')));
     $meeting_day = $formfield->field('Select', 'meeting_day', '', '', 'mand', '', true, '', '', '', '', '', '', '');
     $submit = $formfield->field('Submit', 'Submit', '', '', '', 'Submit', '', '', '', '', '', '', '', '');
     $Back = $formfield->field('Submit', 'Back', '', '', '', 'Back', '', '', '', '', '', '', '', '');
     $this->addElements(array($meeting_name, $group_head, $meeting_place, $meeting_time, $institute_bank_id, $group_name, $meeting_day, $Back, $hiddenId, $submit));
 }
开发者ID:maniargaurav,项目名称:OurBank,代码行数:28,代码来源:Meeting.php

示例2: __construct

 public function __construct($options = null)
 {
     parent::__construct($options);
     $this->setName('serverSettings');
     $server_name = new Zend_Form_Element_Text('name');
     $server_name->setLabel(_r('Name'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim');
     $not_empty = new Zend_Validate_NotEmpty();
     $not_empty->setMessage(_r('Please enter the Server Name'));
     $server_name->addValidators(array($not_empty));
     $hostname = new Zend_Form_Element_Text('hostname');
     $hostname->setLabel(_r('Hostname'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim');
     $not_empty = new Zend_Validate_NotEmpty();
     $not_empty->setMessage(_r('Please enter the Hostname'));
     $hostname->addValidators(array($not_empty));
     $ct_map = new GD_Model_ConnectionTypesMapper();
     $connection_types = $ct_map->fetchAll();
     $connection_type_id = new Zend_Form_Element_Select('connectionTypeId');
     $connection_type_id->setLabel(_r('Connection Type'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim');
     $not_empty = new Zend_Validate_NotEmpty();
     $not_empty->setMessage(_r('Please choose a Connection Type'));
     $connection_type_id->addValidators(array($not_empty));
     foreach ($connection_types as $connection_type) {
         $connection_type_id->addMultiOption($connection_type->getId(), $connection_type->getName());
     }
     $port = new Zend_Form_Element_Text('port');
     $port->setLabel(_r('Port'))->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim');
     $not_empty = new Zend_Validate_NotEmpty();
     $not_empty->setMessage(_r('Please enter the Port Number'));
     $port->addValidators(array($not_empty));
     $username = new Zend_Form_Element_Text('username');
     $username->setLabel(_r('Username'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('autocomplete', 'off');
     $not_empty = new Zend_Validate_NotEmpty();
     $not_empty->setMessage(_r('Please enter the Username'));
     $username->addValidators(array($not_empty));
     $password = new Zend_Form_Element_Password('password');
     $password->setLabel('Password')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('autocomplete', 'off')->setAttrib('renderPassword', true);
     $not_empty = new Zend_Validate_NotEmpty();
     $not_empty->setMessage(_r('Please enter the Password'));
     $password->addValidators(array($not_empty));
     $report_path = new Zend_Form_Element_Text('remotePath');
     $report_path->setLabel(_r('Remote Path'))->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim');
     $submit = new Zend_Form_Element_Image('btn_submit');
     $submit->setImage('/images/buttons/small/save-changes.png');
     $this->addElements(array($server_name, $hostname, $connection_type_id, $port, $username, $password, $report_path, $submit));
 }
开发者ID:robertbasic,项目名称:godeploy,代码行数:45,代码来源:ServerSettings.php

示例3: __construct

 public function __construct($options = null)
 {
     Zend_Dojo::enableForm($this);
     parent::__construct($options);
     $meeting_name = new Zend_Form_Element_Text('meeting_name');
     //$meeting_name->addValidator(new Zend_Validate_Db_NoRecordExists('ob_creditline_details','creditline_name','recordstatus_id=3'));
     $meeting_name->setAttrib('class', 'txt_put');
     $meeting_name->setAttrib('id', 'meetingname');
     $meeting_name->setLabel('meetingname')->setRequired(true)->addValidators(array(array('NotEmpty')));
     $group_head = new Zend_Form_Element_Text('group_head');
     //$group_head->addValidator(new Zend_Validate_Db_NoRecordExists('ob_creditline_details','creditline_name','recordstatus_id=3'));
     $group_head->setAttrib('class', 'txt_put');
     $group_head->setAttrib('id', 'group_head');
     $group_head->setLabel('group_head')->setRequired(true)->addValidators(array(array('NotEmpty')));
     $meeting_place = new Zend_Form_Element_Text('meeting_place');
     //$creditlinename->addValidator(new Zend_Validate_Db_NoRecordExists('ob_creditline_details','creditline_name','recordstatus_id=3'));
     $meeting_place->setAttrib('class', 'txt_put');
     $meeting_place->setAttrib('id', 'meeting_place');
     $meeting_place->setLabel('meeting_place')->setRequired(true)->addValidators(array(array('NotEmpty')));
     $meeting_time = new Zend_Form_Element_Text('meeting_time');
     $meeting_time->addValidator(new Zend_Validate_Db_NoRecordExists('ob_creditline_details', 'creditline_name', 'recordstatus_id=3'));
     $meeting_time->setAttrib('class', 'txt_put');
     $meeting_time->setAttrib('id', 'meeting_time');
     $meeting_time->setLabel('meeting_time')->setRequired(true)->addValidators(array(array('NotEmpty')));
     $office_type = new Zend_Form_Element_Select('office_type');
     $office_type->addMultiOption('', 'Select...');
     $office_type->setAttrib('class', 'txt_put');
     $office_type->addValidators(array(array('NotEmpty')));
     $group_name = new Zend_Form_Element_Select('group_name');
     $group_name->addMultiOption('', 'Select...');
     $group_name->addMultiOption('All', 'All');
     $group_name->setAttrib('class', 'txt_put');
     $group_name->setRequired(true)->addValidators(array(array('NotEmpty')));
     $meeting_day = new Zend_Form_Element_Select('meeting_day');
     $meeting_day->addMultiOption('', 'Select...');
     //$meeting_day->addMultiOption('All','All');
     $meeting_day->setAttrib('class', 'txt_put');
     $meeting_day->setRequired(true)->addValidators(array(array('NotEmpty')));
     $submit = new Zend_Form_Element_Submit('Submit');
     $submit->setAttrib('class', 'officesubmit');
     $submit->setlabel('Submit');
     $this->addElements(array($meeting_name, $group_head, $meeting_place, $meeting_time, $office_type, $group_name, $meeting_day, $submit));
     //===================================================================================================================================
 }
开发者ID:maniargaurav,项目名称:OurBank,代码行数:44,代码来源:Meeting.php

示例4: init

 public function init()
 {
     $this->setMethod(Zend_Form::METHOD_POST);
     $country = new Zend_Form_Element_Select('country');
     $country->setLabel('Country');
     $country->setRequired(true);
     $mdlCountry = new Application_Model_Country();
     $countries = $mdlCountry->listAll();
     $country->addMultiOption(0, 'Select Country');
     foreach ($countries as $countryItem) {
         $country->addMultiOption($countryItem->id, $countryItem->name);
     }
     $country->addValidators(array(new Zend_Validate_Db_RecordExists(array('table' => 'country', 'field' => 'id'))));
     $this->addElement($country);
     $city = new Zend_Form_Element_Select('city');
     $city->setLabel('City');
     $city->setRequired(true);
     $city->setRegisterInArrayValidator(false);
     $city->addValidators(array(new Zend_Validate_Db_RecordExists(array('table' => 'city', 'field' => 'id'))));
     $this->addElement($city);
     $btnSubmit = new Zend_Form_Element_Submit("btnSubmit");
     $btnSubmit->setLabel("Save");
     $this->addElement($btnSubmit);
 }
开发者ID:rogercastaneda,项目名称:zf-ajax-select-dependency,代码行数:24,代码来源:World.php

示例5: __construct

 /**
  * @author code generate
  * @return mixed
  */
 public function __construct($option = array())
 {
     $userId = new Zend_Form_Element_Hidden('TutorId');
     $userId->setDecorators(array('ViewHelper'));
     $this->addElement($userId);
     $birthDay = new Zend_Form_Element_Text('Birthday');
     $birthDay->setLabel('Ngày sinh *');
     $birthDay->addFilter('StringTrim');
     $birthDay->setRequired(true);
     $birthDay->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'))));
     $birthDay->addValidator('stringLength', false, array(2, 50, "messages" => "Ngày sinh dài tối đa 50 ký tự"));
     $this->addElement($birthDay);
     $gender = new Zend_Form_Element_Select('Gender');
     $gender->setLabel('Giới tính *');
     $gender->addFilter('StringTrim');
     $gender->setRequired(true);
     $gender->setMultiOptions(array('1' => 'Nam', '0' => 'Nữ'));
     $gender->setDecorators(array('ViewHelper', array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control')), array('Label', array('class' => 'control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group'))));
     $gender->setSeparator('');
     $gender->setValue("1");
     $this->addElement($gender);
     $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("Tutors", "Email"));
     $email->addValidator('EmailAddress', true);
     $email->setRequired(true)->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => "Email không phù hợp")));
     $this->addElement($email);
     $userName = new Zend_Form_Element_Text('UserName');
     $userName->setLabel('Họ tên *');
     $userName->addFilter('StringTrim');
     $userName->setRequired(true);
     $userName->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'))));
     $userName->addValidator('stringLength', false, array(2, 50, "messages" => "Họ tên dài tối đa 2-50 ký tự"));
     $this->addElement($userName);
     $address = new Zend_Form_Element_Text('Address');
     $address->setLabel('Địa chỉ *');
     $address->addFilter('StringTrim');
     $address->setRequired(true);
     $address->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'))));
     $userName->addValidator('stringLength', false, array(1, 100, "messages" => "Địa chỉ dài tối đa 100 ký tự"));
     $this->addElement($address);
     $phone = new Zend_Form_Element_Text('Phone');
     $phone->setLabel('Điện thoại *');
     $phone->addFilter('StringTrim');
     $phone->setRequired(true);
     $phone->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'))));
     $phone->addValidator('stringLength', false, array(6, 50, "messages" => "Điện thoại dài tối đa 6-50 ký tự"));
     $this->addElement($phone);
     $required = new Zend_Validate_NotEmpty();
     $required->setType($required->getType() | Zend_Validate_NotEmpty::INTEGER | Zend_Validate_NotEmpty::ZERO);
     $level = new Zend_Form_Element_Select('Level');
     $level->setLabel('Trình độ *');
     $level->addFilter('StringTrim');
     $level->addValidator('Int');
     $level->setRequired(true);
     $level->setDecorators(array('ViewHelper', array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control')), array('Label', array('class' => 'control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group'))));
     $level->addValidators(array($required));
     $level->setMultiOptions(unserialize(TUTOR_LEVELS));
     $this->addElement($level);
     $university = new Zend_Form_Element_Text('University');
     $university->setLabel('Trường tốt nghiệp *');
     $university->addFilter('StringTrim');
     $university->setRequired(true);
     $university->setDecorators(array('ViewHelper', array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control')), array('Label', array('class' => 'control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group'))));
     $university->addValidator('stringLength', false, array(1, 100, "messages" => "Trường tố nghiệp dài tối đa 100 ký tự"));
     $this->addElement($university);
     $subject = new Zend_Form_Element_Text('Subject');
     $subject->setLabel('Chuyên ngành *');
     $subject->addFilter('StringTrim');
     $subject->setRequired(true);
     $subject->setDecorators(array('ViewHelper', array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control')), array('Label', array('class' => 'control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group'))));
     $subject->addValidator('stringLength', false, array(1, 100, "messages" => "Chuyên ngành dài tối đa 100 ký tự"));
     $this->addElement($subject);
     $experienceYears = new Zend_Form_Element_Select('ExperienceYears');
     $experienceYears->setLabel('Số Năm Kinh Nghiệm *');
     $experienceYears->addFilter('StringTrim');
     $experienceYears->setRequired(false);
     $experienceYears->setDecorators(array('ViewHelper', array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control')), array('Label', array('class' => 'control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group'))));
     $options = unserialize(EXPERIENCE_YEAR);
     //$experienceYears->addMultiOptions(array_combine($options, $options));
     $experienceYears->setMultiOptions(unserialize(EXPERIENCE_YEAR));
     $this->addElement($experienceYears);
     $career = new Zend_Form_Element_Select('Career');
     $career->setLabel('Hiện tại là *');
     $career->addFilter('StringTrim');
     $career->addValidator('Int');
     $career->setRequired(true);
     $career->setDecorators(array('ViewHelper', array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control')), array('Label', array('class' => 'control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group'))));
     $career->setMultiOptions(unserialize(TUTOR_CAREERS));
     $this->addElement($career);
     $careerLocation = new Zend_Form_Element_Text('CareerLocation');
     $careerLocation->setLabel('Nơi Công Tác ( Giáo hoặc Giảng Viên ) *');
     $careerLocation->addFilter('StringTrim');
//.........这里部分代码省略.........
开发者ID:hocondoimeo,项目名称:giasu-tam.com,代码行数:101,代码来源:Tutors.php


注:本文中的Zend_Form_Element_Select::addValidators方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。