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


PHP Zend_Form_Element_Select::getValidator方法代码示例

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


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

示例1: init

 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'currencyconverter');
     $id = new Zend_Form_Element_Hidden('id');
     $id_val = Zend_Controller_Front::getInstance()->getRequest()->getParam('id');
     $basecurrency = new Zend_Form_Element_Select('basecurrency');
     $basecurrency->setAttrib('class', 'selectoption');
     $basecurrency->addMultiOption('', 'Select base currency');
     $basecurrency->setAttrib('onchange', 'displayTargetCurrency(this)');
     $basecurrency->setRegisterInArrayValidator(false);
     $basecurrency->setRequired(true);
     $basecurrency->addValidator('NotEmpty', false, array('messages' => 'Please select base currency.'));
     $targetcurrency = new Zend_Form_Element_Select('targetcurrency');
     $targetcurrency->setAttrib('class', 'selectoption');
     $targetcurrency->addMultiOption('', 'Select target currency');
     $targetcurrency->setRegisterInArrayValidator(false);
     $targetcurrency->setRequired(true);
     $targetcurrency->addValidator('NotEmpty', false, array('messages' => 'Please select target currency.'));
     if ($id_val == '') {
         $targetcurrency->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_currencyconverter', 'field' => 'targetcurrency', 'exclude' => 'basecurrency="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('basecurrency') . '" AND targetcurrency="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('targetcurrency') . '" and isactive=1')));
         $targetcurrency->getValidator('Db_NoRecordExists')->setMessage('Currency combination already exists.');
     }
     $exchangerate = new Zend_Form_Element_Text("exchangerate");
     $exchangerate->setAttrib('maxLength', 15);
     $exchangerate->addFilter(new Zend_Filter_StringTrim());
     $exchangerate->setRequired(true);
     $exchangerate->addValidator('NotEmpty', false, array('messages' => 'Please enter exchange rate.'));
     $exchangerate->addValidator("regex", false, array("/^[0-9]+(\\.[0-9]{1,6})?\$/", "messages" => "Please enter valid exchange rate."));
     $start_date = new ZendX_JQuery_Form_Element_DatePicker('start_date');
     $start_date->setAttrib('readonly', 'true');
     $start_date->setAttrib('onfocus', 'this.blur()');
     $start_date->setOptions(array('class' => 'brdr_none'));
     $start_date->setRequired(true);
     $start_date->addValidator('NotEmpty', false, array('messages' => 'Please select start date.'));
     $end_date = new ZendX_JQuery_Form_Element_DatePicker('end_date');
     $end_date->setAttrib('readonly', 'true');
     $end_date->setAttrib('onfocus', 'this.blur()');
     $end_date->setOptions(array('class' => 'brdr_none'));
     $end_date->setRequired(true);
     $end_date->addValidator('NotEmpty', false, array('messages' => 'Please select end 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, $basecurrency, $targetcurrency, $exchangerate, $start_date, $end_date, $description, $submit));
     $this->setElementDecorators(array('ViewHelper'));
     $this->setElementDecorators(array('UiWidgetElement'), array('start_date', 'end_date'));
 }
开发者ID:uskumar33,项目名称:DeltaONE,代码行数:53,代码来源:currencyconverter.php

示例2: init

 public function init()
 {
     $this->setMethod('post');
     //$this->setAttrib('action',BASE_URL.'timemanagement/projects/edit');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'projects');
     $id = new Zend_Form_Element_Hidden('id');
     $invoice_method = new Zend_Form_Element_Hidden('invoice_method');
     $project_name = new Zend_Form_Element_Text('project_name');
     $project_name->setAttrib('maxLength', 100);
     $project_name->setRequired(true);
     $project_name->addValidator('NotEmpty', false, array('messages' => 'Please enter project name.'));
     $project_name->addValidator("regex", true, array('pattern' => '/^(?![0-9]*$)[a-zA-Z0-9.,&\\(\\)\\/\\-_\' ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter a valid project name.')));
     $project_name->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'tm_projects', 'field' => 'project_name', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and is_active=1')));
     $project_name->getValidator('Db_NoRecordExists')->setMessage('Project name already exists.');
     $projstatus = new Zend_Form_Element_Select('project_status');
     $projstatus->addMultiOption('', 'Select Status');
     $projstatus->addMultiOption('initiated', 'Initiated');
     $projstatus->addMultiOption('draft', 'Draft');
     $projstatus->addMultiOption('in-progress', 'In Progress');
     $projstatus->addMultiOption('hold', 'Hold');
     $projstatus->addMultiOption('completed', 'Completed');
     $projstatus->setRequired(true);
     $projstatus->setRegisterInArrayValidator(false);
     $projstatus->addValidator('NotEmpty', false, array('messages' => 'Please select status.'));
     $base_project = new Zend_Form_Element_Select('base_project');
     $base_project->addMultiOption('', 'Select Project');
     $base_project->setRegisterInArrayValidator(false);
     $client = new Zend_Form_Element_Select('client_id');
     $client->addMultiOption('', 'Select Client');
     $client->setRegisterInArrayValidator(false);
     $client->setRequired(true);
     $client->addValidator('NotEmpty', false, array('messages' => 'Please select client.'));
     $client->addValidator(new Zend_Validate_Db_RecordExists(array('table' => 'tm_clients', 'field' => 'id', 'exclude' => 'is_active = 1')));
     $client->getValidator('Db_RecordExists')->setMessage('Selected client is inactivated.');
     $description = new Zend_Form_Element_Textarea('description');
     $description->setAttrib('rows', 10);
     $description->setAttrib('cols', 50);
     $description->setAttrib('maxlength', '500');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Save');
     $this->addElements(array($id, $invoice_method, $project_name, $projstatus, $base_project, $description, $client, $submit));
     $this->setElementDecorators(array('ViewHelper'));
     $this->setElementDecorators(array('UiWidgetElement'), array('start_date', 'end_date'));
 }
开发者ID:lukkyrich,项目名称:sentrifugo,代码行数:46,代码来源:Projects.php

示例3: init

 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('action', DOMAIN . 'countries/edit');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'countries');
     $id = new Zend_Form_Element_Hidden('id');
     $country = new Zend_Form_Element_Select('country');
     $country->setAttrib('class', 'selectoption');
     $country->setAttrib('onchange', 'displayCountryCode(this)');
     $country->setRegisterInArrayValidator(false);
     $country->addMultiOption('', 'Select Country');
     $countrymodel = new Default_Model_Countries();
     $id_val = Zend_Controller_Front::getInstance()->getRequest()->getParam('id', null);
     $actionName = Zend_Controller_Front::getInstance()->getRequest()->getActionName();
     if ($id_val == '' || $actionName == 'view') {
         $countrymodeldata = $countrymodel->getTotalCountriesList('addcountry');
         foreach ($countrymodeldata as $countryres) {
             $country->addMultiOption($countryres['id'], utf8_encode($countryres['country_name']));
         }
         $country->addMultiOption('other', 'Other');
     }
     $country->setRequired(true);
     $country->addValidator('NotEmpty', false, array('messages' => 'Please select country.'));
     $country->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_countries', 'field' => 'country_id_org', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive=1')));
     $country->getValidator('Db_NoRecordExists')->setMessage('Country already exists.');
     $countrycode = new Zend_Form_Element_Text('countrycode');
     $countrycode->setAttrib('maxLength', 20);
     $countrycode->setAttrib('readonly', true);
     $countrycode->setAttrib('onfocus', 'this.blur()');
     $countrycode->setRequired(true);
     $countrycode->addValidator('NotEmpty', false, array('messages' => 'Please enter country code.'));
     $countrycode->addValidator("regex", true, array('pattern' => '/^(?=.*[a-zA-Z])([^ ][a-zA-Z0-9 ]*)$/', 'messages' => array('regexNotMatch' => 'Please enter valid country code.')));
     $citizenship = new Zend_Form_Element_Text('citizenship');
     $citizenship->setAttrib('maxLength', 20);
     $citizenship->setRequired(true);
     $citizenship->addValidator('NotEmpty', false, array('messages' => 'Please enter citizenship.'));
     $citizenship->addValidator("regex", true, array('pattern' => '/^[a-zA-Z\\s]*$/i', 'messages' => array('regexNotMatch' => 'Please enter valid citizenship.')));
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Save');
     $this->addElements(array($id, $country, $countrycode, $citizenship, $submit));
     $this->setElementDecorators(array('ViewHelper'));
 }
开发者ID:uskumar33,项目名称:DeltaONE,代码行数:44,代码来源:countries.php

示例4: init

 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('action', DOMAIN . 'employee/add');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'employee');
     $controller_name = Zend_Controller_Front::getInstance()->getRequest()->getControllerName();
     $id = new Zend_Form_Element_Hidden('id');
     $id_val = Zend_Controller_Front::getInstance()->getRequest()->getParam('id', null);
     $userid = new Zend_Form_Element_Hidden('user_id');
     $reportingmanager = new Zend_Form_Element_Select('reporting_manager');
     $reportingmanager->addMultiOption('', 'Select Reporting Manager');
     $reportingmanager->setRegisterInArrayValidator(false);
     if ($controller_name != 'organisationinfo') {
         $reportingmanager->setRequired(true);
         $reportingmanager->addValidator('NotEmpty', false, array('messages' => 'Please select reporting manager.'));
     }
     $reportingmanager->addValidator(new Zend_Validate_Db_RecordExists(array('table' => 'main_users', 'field' => 'id', 'exclude' => 'isactive = 1')));
     $reportingmanager->getValidator('Db_RecordExists')->setMessage('Selected reporting manager is inactivated.');
     $emproleStr = Zend_Controller_Front::getInstance()->getRequest()->getParam('emprole', null);
     $empstatus = new Zend_Form_Element_Select('emp_status_id');
     $empstatus->setAttrib('onchange', 'displayempstatusmessage()');
     $empstatus->setRegisterInArrayValidator(false);
     if ($controller_name != 'organisationinfo') {
         $empstatus->setRequired(true);
         $empstatus->addValidator('NotEmpty', false, array('messages' => 'Please select employment status.'));
     }
     $empstatus->addValidator(new Zend_Validate_Db_RecordExists(array('table' => 'main_employmentstatus', 'field' => 'workcodename', 'exclude' => 'isactive = 1')));
     $empstatus->getValidator('Db_RecordExists')->setMessage('Selected employment status is deleted.');
     $businessunit = new Zend_Form_Element_Select('businessunit_id');
     $businessunit->setAttrib('onchange', 'displayEmployeeDepartments(this,"department_id","")');
     $businessunit->addValidator(new Zend_Validate_Db_RecordExists(array('table' => 'main_businessunits', 'field' => 'id', 'exclude' => 'isactive = 1')));
     $businessunit->getValidator('Db_RecordExists')->setMessage('Selected business unit is deleted.');
     $department = new Zend_Form_Element_Select('department_id');
     $department->addMultiOption('', 'Select Department');
     $department->setRegisterInArrayValidator(false);
     $roleArr = array();
     if ($controller_name != 'organisationinfo') {
         //For management 'department is not manditory'......
         if ($emproleStr != "") {
             $roleArr = explode('_', $emproleStr);
             if (!empty($roleArr)) {
                 if (isset($roleArr[1]) && $roleArr[1] != MANAGEMENT_GROUP) {
                     $department->setRequired(true);
                     $department->addValidator('NotEmpty', false, array('messages' => 'Please select department.'));
                 }
             }
         } else {
             $department->setRequired(true);
             $department->addValidator('NotEmpty', false, array('messages' => 'Please select department.'));
         }
     }
     $department->setAttrib("onchange", "displayReportingmanagers_emp('department_id','reporting_manager','emprole','id')");
     $department->addValidator(new Zend_Validate_Db_RecordExists(array('table' => 'main_departments', 'field' => 'id', 'exclude' => 'isactive = 1')));
     $department->getValidator('Db_RecordExists')->setMessage('Selected department is deleted.');
     $jobtitle = new Zend_Form_Element_Select('jobtitle_id');
     $jobtitle->setLabel("Job Title");
     $jobtitle->addMultiOption('', 'Select Job Title');
     $jobtitle->setAttrib('onchange', 'displayPositions(this,"position_id","")');
     $jobtitle->setRegisterInArrayValidator(false);
     $jobtitle->addValidator(new Zend_Validate_Db_RecordExists(array('table' => 'main_jobtitles', 'field' => 'id', 'exclude' => 'isactive = 1')));
     $jobtitle->getValidator('Db_RecordExists')->setMessage('Selected job title is deleted.');
     $position = new Zend_Form_Element_Select('position_id');
     $position->setLabel("Position");
     $position->addMultiOption('', 'Select Position');
     $position->setRegisterInArrayValidator(false);
     $position->addValidator(new Zend_Validate_Db_RecordExists(array('table' => 'main_positions', 'field' => 'id', 'exclude' => 'isactive = 1')));
     $position->getValidator('Db_RecordExists')->setMessage('Selected position is deleted.');
     $prefix_id = new Zend_Form_Element_Select('prefix_id');
     $prefix_id->addMultiOption('', 'Select Prefix');
     $prefix_id->setLabel("Prefix");
     $prefix_id->setRegisterInArrayValidator(false);
     $prefix_id->addValidator(new Zend_Validate_Db_RecordExists(array('table' => 'main_prefix', 'field' => 'id', 'exclude' => 'isactive = 1')));
     $prefix_id->getValidator('Db_RecordExists')->setMessage('Selected prefix is deleted.');
     $extension_number = new Zend_Form_Element_Text('extension_number');
     $extension_number->setAttrib('maxLength', 4);
     $extension_number->setLabel("Extension");
     $extension_number->addFilter(new Zend_Filter_StringTrim());
     $extension_number->addValidator("regex", true, array('pattern' => '/^[0-9]+$/', 'messages' => array('regexNotMatch' => 'Please enter only numbers.')));
     $office_number = new Zend_Form_Element_Text('office_number');
     $office_number->setAttrib('maxLength', 10);
     $office_number->setLabel("Work Telephone Number");
     $office_number->addFilter(new Zend_Filter_StringTrim());
     $office_number->addValidator("regex", true, array('pattern' => '/^(?!0{10})[0-9\\+\\-\\)\\(]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid phone number.')));
     $office_faxnumber = new Zend_Form_Element_Text('office_faxnumber');
     $office_faxnumber->setAttrib('maxLength', 15);
     $office_faxnumber->setLabel("Fax");
     $office_faxnumber->addFilter(new Zend_Filter_StringTrim());
     $office_faxnumber->addValidator("regex", true, array('pattern' => '/^[0-9\\+\\-\\)\\(]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid fax number.')));
     $yearsofexp = new Zend_Form_Element_Text('years_exp');
     $yearsofexp->setAttrib('maxLength', 2);
     $yearsofexp->addFilter(new Zend_Filter_StringTrim());
     $yearsofexp->addValidator("regex", true, array('pattern' => '/^[0-9]\\d{0,1}(\\.\\d*)?$/', 'messages' => array('regexNotMatch' => 'Please enter only numbers.')));
     $date_of_joining = new ZendX_JQuery_Form_Element_DatePicker('date_of_joining');
     $date_of_joining->setLabel("Date Of Joining");
     $date_of_joining->setOptions(array('class' => 'brdr_none'));
     $date_of_joining->setRequired(true);
     $date_of_joining->setAttrib('readonly', 'true');
     $date_of_joining->setAttrib('onfocus', 'this.blur()');
     $date_of_joining->addValidator('NotEmpty', false, array('messages' => 'Please select date of joining.'));
//.........这里部分代码省略.........
开发者ID:lukkyrich,项目名称:sentrifugo,代码行数:101,代码来源:employee.php

示例5: init

 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('action', BASE_URL . 'timemanagement/expenses/edit');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'expensecategory');
     $id = new Zend_Form_Element_Hidden('id');
     $client = new Zend_Form_Element_Select('client_id');
     $client->addMultiOption('', 'Select Client');
     $client->setRegisterInArrayValidator(false);
     $client->setAttrib('onchange', 'loadProjects(this)');
     $client->setRequired(true);
     $client->addValidator('NotEmpty', false, array('messages' => 'Please select Client.'));
     $client->addValidator(new Zend_Validate_Db_RecordExists(array('table' => 'tm_clients', 'field' => 'id', 'exclude' => 'is_active = 1')));
     $client->getValidator('Db_RecordExists')->setMessage('Selected Client is inactivated.');
     $project = new Zend_Form_Element_Select('project_id');
     $project->addMultiOption('', 'Select Project');
     $project->setRegisterInArrayValidator(false);
     $project->setRequired(true);
     $project->addValidator('NotEmpty', false, array('messages' => 'Please select Project.'));
     $project->addValidator(new Zend_Validate_Db_RecordExists(array('table' => 'tm_projects', 'field' => 'id', 'exclude' => 'is_active = 1')));
     $project->getValidator('Db_RecordExists')->setMessage('Selected Project is inactivated.');
     $category = new Zend_Form_Element_Select('expense_cat_id');
     $category->addMultiOption('', 'Select Category');
     $category->setRegisterInArrayValidator(false);
     $category->setRequired(true);
     $category->addValidator('NotEmpty', false, array('messages' => 'Please select Category.'));
     $category->addValidator(new Zend_Validate_Db_RecordExists(array('table' => 'tm_expense_categories', 'field' => 'id', 'exclude' => 'is_active = 1')));
     $category->getValidator('Db_RecordExists')->setMessage('Selected Category is inactivated.');
     $expenseDate = new ZendX_JQuery_Form_Element_DatePicker('expense_date');
     $expenseDate->setOptions(array('class' => 'brdr_none'));
     //$date_of_leaving->setAttrib('onchange', 'validatejoiningdate(this)');
     $expenseDate->setAttrib('readonly', 'true');
     $expenseDate->setAttrib('onfocus', 'this.blur()');
     $expenseAmount = new Zend_Form_Element_Text('expense_amount');
     $expenseAmount->setAttrib('maxLength', 8);
     $expenseAmount->setLabel("Unit Price");
     $expenseAmount->addValidator("regex", true, array('pattern' => '/^[1-9]\\d{1,4}(\\.\\d{1,2})?$/', 'messages' => array('regexNotMatch' => 'Please enter valid Amount.')));
     $note = new Zend_Form_Element_Text('note');
     $note->setAttrib('maxLength', 200);
     $note->setLabel("Note");
     $billable = new Zend_Form_Element_Radio('is_billable');
     $billable->setLabel("Type");
     $billable->addMultiOptions(array('1' => 'Yes', '0' => 'No'));
     $billable->setSeparator('');
     $billable->setValue('billable');
     $billable->setRegisterInArrayValidator(false);
     $billable->setRequired(true);
     $billable->addValidator('NotEmpty', false, array('messages' => 'Please select Type.'));
     /*
     client_idbigint(20) unsigned NOT NULL
     project_idbigint(20) unsigned NOT NULL
     expense_cat_idint(10) unsigned NOT NULL
     expense_datetimestamp NOT NULL
     expense_amountdecimal(8,2) unsigned NOT NULL
     notevarchar(200) NULL
     is_billabletinyint(1) unsigned NOT NULL
     receipt_filevarchar(200) NULL
     expense_statusenum('saved','submitted','approved','rejected') NULL
     status_update_datetimestamp NOT NULL
     status_update_byint(11) NULL
     reject_notevarchar(200) NULL
     */
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Save');
     $this->addElements(array($id, $client, $project, $category, $expenseDate, $expenseAmount, $note, $billable, $submit));
     $this->setElementDecorators(array('ViewHelper'));
     $this->setElementDecorators(array('UiWidgetElement'), array('expense_date'));
 }
开发者ID:lukkyrich,项目名称:sentrifugo,代码行数:70,代码来源:Expenses.php

示例6: init

 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('action', DOMAIN . 'myemployees/add');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'myteamemployee');
     $controller_name = Zend_Controller_Front::getInstance()->getRequest()->getControllerName();
     $id = new Zend_Form_Element_Hidden('id');
     $id_val = Zend_Controller_Front::getInstance()->getRequest()->getParam('id', null);
     $userid = new Zend_Form_Element_Hidden('user_id');
     $employeeId = new Zend_Form_Element_Text("employeeId");
     $employeeId->setRequired("true");
     $employeeId->setLabel("Employee ID");
     $employeeId->setAttrib("class", "formDataElement");
     $employeeId->setAttrib("readonly", "readonly");
     $employeeId->setAttrib('onfocus', 'this.blur()');
     $employeeId->addValidator('NotEmpty', false, array('messages' => 'Identity codes are not configured yet.'));
     $employeeId->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_users', 'field' => 'employeeId', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('user_id', 0) . '" ')));
     $employeeId->getValidator('Db_NoRecordExists')->setMessage('Employee ID already exists. Please try again.');
     $prefix_id = new Zend_Form_Element_Select('prefix_id');
     $prefix_id->addMultiOption('', 'Select Prefix');
     $prefix_id->setLabel("Prefix");
     $prefix_id->setRegisterInArrayValidator(false);
     $prefix_id->addValidator(new Zend_Validate_Db_RecordExists(array('table' => 'main_prefix', 'field' => 'id', 'exclude' => 'isactive = 1')));
     $prefix_id->getValidator('Db_RecordExists')->setMessage('Selected prefix is deleted.');
     $first_name = new Zend_Form_Element_Text("firstname");
     $first_name->setLabel("First Name");
     $first_name->setRequired(true);
     $first_name->addValidator('NotEmpty', false, array('messages' => 'Please enter first name.'));
     $first_name->setAttrib("class", "formDataElement");
     $first_name->setAttrib('maxlength', 50);
     $first_name->addValidator("regex", true, array('pattern' => '/^([a-zA-Z.]+ ?)+$/', 'messages' => array('regexNotMatch' => 'Please enter only alphabets.')));
     $last_name = new Zend_Form_Element_Text("lastname");
     $last_name->setLabel("Last Name");
     $last_name->setRequired(true);
     $last_name->addValidator('NotEmpty', false, array('messages' => 'Please enter last name.'));
     $last_name->setAttrib("class", "formDataElement");
     $last_name->setAttrib('maxlength', 50);
     $last_name->addValidator("regex", true, array('pattern' => '/^([a-zA-Z.]+ ?)+$/', 'messages' => array('regexNotMatch' => 'Please enter only alphabets.')));
     $modeofentry = new Zend_Form_Element_Select("modeofentry");
     $modeofentry->setLabel("Mode of Employment")->addMultiOptions(array('Direct' => 'Direct'));
     $modeofentry->setAttrib("class", "formDataElement");
     if ($id_val == '') {
         $modeofentry->setRequired(true);
         $modeofentry->addValidator('NotEmpty', false, array('messages' => 'Please select mode of employment.'));
     }
     $emprole = new Zend_Form_Element_Select("emprole");
     $emprole->setRegisterInArrayValidator(false);
     $emprole->setRequired(true);
     $emprole->setLabel("Role");
     $emprole->setAttrib("class", "formDataElement");
     $emprole->addValidator('NotEmpty', false, array('messages' => 'Please select role.'));
     $emprole->addValidator(new Zend_Validate_Db_RecordExists(array('table' => 'main_roles', 'field' => 'id', 'exclude' => 'isactive = 1')));
     $emprole->getValidator('Db_RecordExists')->setMessage('Selected role is deleted.');
     $emailaddress = new Zend_Form_Element_Text("emailaddress");
     $emailaddress->setRequired(true);
     $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->setLabel("Email");
     $emailaddress->setAttrib("class", "formDataElement");
     $emailaddress->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_users', 'field' => 'emailaddress', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('user_id', 0) . '" ')));
     $emailaddress->getValidator('Db_NoRecordExists')->setMessage('Email already exists.');
     $businessunit = new Zend_Form_Element_Select('businessunit_id');
     $businessunit->setRegisterInArrayValidator(false);
     $businessunit->addValidator(new Zend_Validate_Db_RecordExists(array('table' => 'main_businessunits', 'field' => 'id', 'exclude' => 'isactive = 1')));
     $businessunit->getValidator('Db_RecordExists')->setMessage('Selected business unit is deleted.');
     $department = new Zend_Form_Element_Select('department_id');
     $department->setRegisterInArrayValidator(false);
     $department->setRequired(true);
     $department->addValidator('NotEmpty', false, array('messages' => 'Please select department.'));
     $department->addValidator(new Zend_Validate_Db_RecordExists(array('table' => 'main_departments', 'field' => 'id', 'exclude' => 'isactive = 1')));
     $department->getValidator('Db_RecordExists')->setMessage('Selected department is deleted.');
     $reportingmanager = new Zend_Form_Element_Select('reporting_manager');
     $reportingmanager->setRegisterInArrayValidator(false);
     $reportingmanager->setRequired(true);
     $reportingmanager->addValidator('NotEmpty', false, array('messages' => 'Please select reporting manager.'));
     $reportingmanager->addValidator(new Zend_Validate_Db_RecordExists(array('table' => 'main_users', 'field' => 'id', 'exclude' => 'isactive = 1')));
     $reportingmanager->getValidator('Db_RecordExists')->setMessage('Selected reporting manager is inactivated.');
     $jobtitle = new Zend_Form_Element_Select('jobtitle_id');
     $jobtitle->setLabel("Job Title");
     $jobtitle->addMultiOption('', 'Select Job Title');
     $jobtitle->setAttrib('onchange', 'displayPositions(this,"position_id","")');
     $jobtitle->setRegisterInArrayValidator(false);
     $jobtitle->addValidator(new Zend_Validate_Db_RecordExists(array('table' => 'main_jobtitles', 'field' => 'id', 'exclude' => 'isactive = 1')));
     $jobtitle->getValidator('Db_RecordExists')->setMessage('Selected job title is deleted.');
     $position = new Zend_Form_Element_Select('position_id');
     $position->setLabel("Position");
     $position->addMultiOption('', 'Select Position');
     $position->setRegisterInArrayValidator(false);
     $position->addValidator(new Zend_Validate_Db_RecordExists(array('table' => 'main_positions', 'field' => 'id', 'exclude' => 'isactive = 1')));
     $position->getValidator('Db_RecordExists')->setMessage('Selected position is deleted.');
     $empstatus = new Zend_Form_Element_Select('emp_status_id');
     $empstatus->setAttrib('onchange', 'displayempstatusmessage()');
     $empstatus->setRegisterInArrayValidator(false);
     $empstatus->setRequired(true);
     $empstatus->addValidator('NotEmpty', false, array('messages' => 'Please select employment status.'));
     $empstatus->addValidator(new Zend_Validate_Db_RecordExists(array('table' => 'main_employmentstatus', 'field' => 'workcodename', 'exclude' => 'isactive = 1')));
     $empstatus->getValidator('Db_RecordExists')->setMessage('Selected employment status is deleted.');
     $date_of_joining = new ZendX_JQuery_Form_Element_DatePicker('date_of_joining');
     $date_of_joining->setLabel("Date Of Joining");
//.........这里部分代码省略.........
开发者ID:rajbrt,项目名称:sentrifugo,代码行数:101,代码来源:Myteamemployee.php

示例7: createFormSelectElement

 /**
  * Utility function to create a select form element of countries
  *
  * @param string $name The element name (default `country`)
  * @param string $label The element label and title (default `Country`)
  * @return Zend_Form_Element_Select
  */
 public static function createFormSelectElement($name = 'country', $label = 'Country')
 {
     $country = new Zend_Form_Element_Select($name);
     $country->setLabel($label)->setAttrib('title', $label)->setMultiOptions(['' => ' '] + self::getCountriesArray())->setAttrib('data-placeholder', 'Select your country...')->addValidator('InArray', true, [self::getCountriesKeys()]);
     $country->getValidator('InArray')->setMessage('You must choose a country', Zend_Validate_InArray::NOT_IN_ARRAY);
     return $country;
 }
开发者ID:opensolutions,项目名称:oss-framework,代码行数:14,代码来源:Countries.php


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