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


PHP Zend_Form_Element_Select::addValidator方法代码示例

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


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

示例1: __construct

 public function __construct(array $dataBusinessId, $options = null)
 {
     parent::__construct($options);
     $this->setName('frmEmployee');
     $this->setMethod('post');
     $name = new Zend_Form_Element_Text('name');
     $name->setLabel('Employee name');
     $name->setAttrib('maxlength', 80);
     $name->setRequired(true);
     $name->addValidator(new Zend_Validate_NotEmpty());
     $this->addElement($name);
     $age = new Zend_Form_Element_Text('age');
     $age->setLabel('Employee age');
     $age->addValidator(new Zend_Validate_Int());
     $this->addElement($age);
     $businessId = new Zend_Form_Element_Select('business_id');
     $businessId->setLabel('Business');
     $businessId->setRequired(true);
     $businessId->addValidator(new Zend_Validate_NotEmpty());
     $businessId->addValidator(new Zend_Validate_Int());
     $businessId->addMultiOptions($dataBusinessId);
     $this->addElement($businessId);
     $submit = new Zend_Form_Element_Submit('bt_submit');
     $submit->setLabel('Save');
     $this->addElement($submit);
 }
开发者ID:Marcosdbras,项目名称:zend-form-generator,代码行数:26,代码来源:Employee.php

示例2: 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

示例3: init

 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('action', DOMAIN . 'employee/add');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'empskills');
     $id = new Zend_Form_Element_Hidden('id');
     $userid = new Zend_Form_Element_Hidden('user_id');
     $skillname = new Zend_Form_Element_Text('skillname');
     $skillname->setRequired(true);
     $skillname->setAttrib('maxLength', 50);
     $skillname->addFilter('StripTags');
     $skillname->addFilter('StringTrim');
     $skillname->addValidator('NotEmpty', false, array('messages' => 'Please enter skill.'));
     $yearsofexp = new Zend_Form_Element_Text('yearsofexp');
     $yearsofexp->setAttrib('maxLength', 5);
     $yearsofexp->addFilter(new Zend_Filter_StringTrim());
     $yearsofexp->setRequired(true);
     $yearsofexp->addValidator('NotEmpty', false, array('messages' => 'Please enter years of experience.'));
     $yearsofexp->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[0-9]\\d{0,1}(\\.\\d*)?$/', 'messages' => array('regexNotMatch' => 'Please enter numbers less than 100.')))));
     $competencylevelid = new Zend_Form_Element_Select('competencylevelid');
     $competencylevelid->setRequired(true)->addErrorMessage('Please select competency level.');
     $competencylevelid->addValidator('NotEmpty', false, array('messages' => 'Please select competency level.'));
     $competencylevelid->setRegisterInArrayValidator(false);
     $year_skill = new ZendX_JQuery_Form_Element_DatePicker('year_skill_last_used');
     $year_skill->setOptions(array('class' => 'brdr_none'));
     $year_skill->setAttrib('readonly', 'true');
     $year_skill->setAttrib('onfocus', 'this.blur()');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Save');
     $this->addElements(array($id, $userid, $skillname, $yearsofexp, $competencylevelid, $year_skill, $submit));
     $this->setElementDecorators(array('ViewHelper'));
     $this->setElementDecorators(array('UiWidgetElement'), array('year_skill_last_used'));
 }
开发者ID:uskumar33,项目名称:DeltaONE,代码行数:35,代码来源:empskills.php

示例4: __construct

 public function __construct($options = null)
 {
     $baseDir = $options['baseDir'];
     parent::__construct($options);
     /****************************************/
     // PARAMETERS
     /****************************************/
     // Build the select to choose the associated form (Parameter #1)
     $blockForm = new Zend_Form_Element_Select('Param1');
     $blockForm->setLabel('Formulaire associé à ce bloc')->setAttrib('class', 'largeSelect');
     $forms = new Form();
     $select = $forms->getFormList();
     $formsArray = $forms->fetchAll($select);
     // Set the default value
     $blockForm->addMultiOption('0', 'Choisir un formulaire');
     //Fill the dropdown list
     foreach ($formsArray as $form) {
         $blockForm->addMultiOption($form['F_ID'], $form['FI_Title']);
     }
     // Test if a value has been chosen
     $at_least_one = new Zend_Validate_GreaterThan('0');
     $at_least_one->setMessage('Vous devez choisir un élément dans la liste.');
     $blockForm->addValidator($at_least_one);
     $this->addElements(array($blockForm));
     $this->removeDisplayGroup('parameters');
     $this->addDisplayGroup(array('Param999', 'Param1'), 'parameters');
     $parameters = $this->getDisplayGroup('parameters');
 }
开发者ID:anunay,项目名称:stentors,代码行数:28,代码来源:FormBlockForm.php

示例5: init

 public function init()
 {
     $this->setMethod('post')->setAttrib('id', 'frmVenta')->setAttrib('style', 'width: 300px;margin:auto;');
     // Producto
     $e = new Zend_Form_Element_Select('id_producto');
     $e->setLabel('Producto');
     $e->setRequired();
     $_producto = new Application_Model_Producto();
     $e->addMultiOption(-1, '--Producto--');
     $e->addMultiOptions($_producto->getComboValues());
     $e->addValidator(new Zend_Validate_InArray($_producto->getComboValidValues()));
     $this->addElement($e);
     // Cantidad
     $e = new Zend_Form_Element_Text('cantidad');
     $e->setLabel('Cantidad');
     $e->setRequired();
     $e->addValidator(new Zend_Validate_Int(new Zend_Locale('US')));
     $e->addValidator(new Zend_Validate_GreaterThan(0));
     $e->addValidator(new Zend_Validate_LessThan(100));
     $this->addElement($e);
     // AddVentaDetalles
     $e = new Zend_Form_Element_Hidden('is_detalle');
     $e->setValue(true);
     $e->setRequired();
     $this->addElement($e);
     //Submit
     $e = new Zend_Form_Element_Submit('submit');
     $e->setLabel('Agregar');
     $this->addElement($e);
 }
开发者ID:helmutpacheco,项目名称:ventas,代码行数:30,代码来源:VentaDetalle.php

示例6: init

 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('action', DOMAIN . 'states/edit');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'states');
     $id = new Zend_Form_Element_Hidden('id');
     $country = new Zend_Form_Element_Select('countryid');
     $country->setAttrib('class', 'selectoption');
     $country->setAttrib('onchange', 'displayParticularState(this,"otheroption","state","")');
     $country->setRegisterInArrayValidator(false);
     $country->addMultiOption('', 'Select Country');
     $country->setRequired(true);
     $country->addValidator('NotEmpty', false, array('messages' => 'Please select country.'));
     $state = new Zend_Form_Element_Multiselect('state');
     $state->setAttrib('onchange', 'displayStateCode(this)');
     $state->setRegisterInArrayValidator(false);
     $state->setRequired(true);
     $state->addValidator('NotEmpty', false, array('messages' => 'Please select state.'));
     $state->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_states', 'field' => 'state_id_org', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive=1')));
     $state->getValidator('Db_NoRecordExists')->setMessage('State already exists.');
     $otherstatename = new Zend_Form_Element_Text('otherstatename');
     $otherstatename->setAttrib('maxLength', 20);
     $otherstatename->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[^ ][a-zA-Z\\s]*$/i', 'messages' => array('regexNotMatch' => 'Please enter valid state name.')))));
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Save');
     $this->addElements(array($id, $country, $state, $otherstatename, $submit));
     $this->setElementDecorators(array('ViewHelper'));
 }
开发者ID:uskumar33,项目名称:DeltaONE,代码行数:30,代码来源:states.php

示例7: init

 /** Initialize this form. */
 public function init()
 {
     $this->setName('sizequota_admin');
     $this->setMethod('POST');
     $csrf = new Midas_Form_Element_Hash('csrf');
     $csrf->setSalt('f6g5NzqPWAunkSykbBpmTmpH');
     $csrf->setDecorators(array('ViewHelper'));
     $defaultUserQuotaValue = new Zend_Form_Element_Text(MIDAS_SIZEQUOTA_DEFAULT_USER_QUOTA_VALUE_KEY);
     $defaultUserQuotaValue->setLabel('Default User Quota');
     $defaultUserQuotaValue->addValidator('Float', true);
     $defaultUserQuotaValue->addValidator('Between', true, array('min' => 0, 'max' => PHP_INT_MAX));
     $defaultUserQuotaUnit = new Zend_Form_Element_Select(MIDAS_SIZEQUOTA_DEFAULT_USER_QUOTA_UNIT_KEY);
     $defaultUserQuotaUnit->setLabel('Unit');
     $defaultUserQuotaUnit->setRequired(true);
     $defaultUserQuotaUnit->addValidator('NotEmpty', true);
     $defaultUserQuotaUnit->addMultiOptions(array(MIDAS_SIZE_B => 'B', MIDAS_SIZE_KB => 'KB', MIDAS_SIZE_MB => 'MB', MIDAS_SIZE_GB => 'GB', MIDAS_SIZE_TB => 'TB'));
     $this->addDisplayGroup(array($defaultUserQuotaValue, $defaultUserQuotaUnit), 'default_user_quota');
     $defaultCommunityQuotaValue = new Zend_Form_Element_Text(MIDAS_SIZEQUOTA_DEFAULT_COMMUNITY_QUOTA_VALUE_KEY);
     $defaultCommunityQuotaValue->setLabel('Default Community Quota');
     $defaultCommunityQuotaValue->addValidator('Float', true);
     $defaultCommunityQuotaValue->addValidator('Between', true, array('min' => 0, 'max' => PHP_INT_MAX));
     $defaultCommunityQuotaUnit = new Zend_Form_Element_Select(MIDAS_SIZEQUOTA_DEFAULT_COMMUNITY_QUOTA_UNIT_KEY);
     $defaultCommunityQuotaUnit->setLabel('Unit');
     $defaultCommunityQuotaUnit->setRequired(true);
     $defaultCommunityQuotaUnit->addValidator('NotEmpty', true);
     $defaultCommunityQuotaUnit->addMultiOptions(array(MIDAS_SIZE_B => 'B', MIDAS_SIZE_KB => 'KB', MIDAS_SIZE_MB => 'MB', MIDAS_SIZE_GB => 'GB', MIDAS_SIZE_TB => 'TB'));
     $this->addDisplayGroup(array($defaultCommunityQuotaValue, $defaultCommunityQuotaUnit), 'default_community_quota');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel('Save');
     $this->addElements(array($csrf, $defaultUserQuotaValue, $defaultUserQuotaUnit, $defaultCommunityQuotaValue, $defaultCommunityQuotaUnit, $submit));
 }
开发者ID:josephsnyder,项目名称:Midas,代码行数:32,代码来源:Admin.php

示例8: init

 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'positions');
     $id = new Zend_Form_Element_Hidden('id');
     $emptyflag = new Zend_Form_Element_Hidden('emptyFlag');
     $positionname = new Zend_Form_Element_Text('positionname');
     $positionname->setAttrib('maxLength', 50);
     $positionname->setRequired(true);
     $positionname->addValidator('NotEmpty', false, array('messages' => 'Please enter position.'));
     $positionname->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z][a-zA-Z0-9\\-\\s]*$/i', 'messages' => array('regexNotMatch' => 'Please enter valid position.')))));
     $positionname->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_positions', 'field' => 'positionname', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive=1')));
     $positionname->getValidator('Db_NoRecordExists')->setMessage('Position already exists.');
     $jobtitleid = new Zend_Form_Element_Select('jobtitleid');
     $jobtitleid->setAttrib('class', 'selectoption');
     $jobtitleid->setRegisterInArrayValidator(false);
     $jobtitleid->addMultiOption('', 'Select Job Title');
     $jobtitleid->setRequired(true);
     $jobtitleid->addValidator('NotEmpty', false, array('messages' => 'Please select job title.'));
     $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, $positionname, $jobtitleid, $description, $emptyflag, $submit));
     $this->setElementDecorators(array('ViewHelper'));
 }
开发者ID:uskumar33,项目名称:DeltaONE,代码行数:30,代码来源:positions.php

示例9: init

 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('action', DOMAIN . 'workeligibilitydoctypes/edit');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'workeligibilitydoctypes');
     $id = new Zend_Form_Element_Hidden('id');
     $documenttype = new Zend_Form_Element_Text('documenttype');
     $documenttype->setAttrib('maxLength', 50);
     $documenttype->setRequired(true);
     $documenttype->addValidator('NotEmpty', false, array('messages' => 'Please enter document type.'));
     $documenttype->addValidator("regex", true, array('pattern' => '/^(?=.*[a-zA-Z])([^ ][a-zA-Z0-9\\-\\s]*)$/', 'messages' => array('regexNotMatch' => 'Please enter valid document type.')));
     $documenttype->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_workeligibilitydoctypes', 'field' => 'documenttype', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive=1')));
     $documenttype->getValidator('Db_NoRecordExists')->setMessage('Document type already exists.');
     $issuingauthority = new Zend_Form_Element_Select('issuingauthority');
     $issuingauthority->setRegisterInArrayValidator(false);
     $issuingauthority->setMultiOptions(array('' => 'Select issuing authority', '1' => 'Country', '2' => 'State', '3' => 'City'));
     $issuingauthority->setRequired(true);
     $issuingauthority->addValidator('NotEmpty', false, array('messages' => 'Please select issuing authority.'));
     $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, $documenttype, $issuingauthority, $description, $submit));
     $this->setElementDecorators(array('ViewHelper'));
 }
开发者ID:uskumar33,项目名称:DeltaONE,代码行数:29,代码来源:workeligibilitydoctypes.php

示例10: init

 /** Initialize this form. */
 public function init()
 {
     $this->setName('sizequota_folder');
     $this->setAction($this->getView()->baseUrl('/sizequota/folder/submit'));
     $this->setMethod('POST');
     $csrf = new Midas_Form_Element_Hash('csrf');
     $csrf->setSalt('FDXuUnSDkUE7Anh2kqgca8zv');
     $csrf->setDecorators(array('ViewHelper'));
     $folderId = new Zend_Form_Element_Hidden('folder_id');
     $folderId->setDecorators(array('ViewHelper'));
     $useDefaultFolderQuota = new Zend_Form_Element_Checkbox('use_default_folder_quota');
     $useDefaultFolderQuota->setLabel('Use Default Folder Quota');
     $folderQuotaValue = new Zend_Form_Element_Text('folder_quota_value');
     $folderQuotaValue->setLabel('Quota');
     $folderQuotaValue->addValidator('Float', true);
     $folderQuotaValue->addValidator('Between', true, array('min' => 0, 'max' => PHP_INT_MAX));
     $folderQuotaUnit = new Zend_Form_Element_Select('folder_quota_unit');
     $folderQuotaUnit->setLabel('Unit');
     $folderQuotaUnit->setRequired(true);
     $folderQuotaUnit->addValidator('NotEmpty', true);
     $folderQuotaUnit->addMultiOptions(array(MIDAS_SIZE_B => 'B', MIDAS_SIZE_KB => 'KB', MIDAS_SIZE_MB => 'MB', MIDAS_SIZE_GB => 'GB', MIDAS_SIZE_TB => 'TB'));
     $this->addDisplayGroup(array($useDefaultFolderQuota, $folderQuotaValue, $folderQuotaUnit), 'global');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel('Save');
     $this->addElements(array($csrf, $folderId, $useDefaultFolderQuota, $folderQuotaValue, $folderQuotaUnit, $submit));
 }
开发者ID:josephsnyder,项目名称:Midas,代码行数:27,代码来源:Folder.php

示例11: init

 function init()
 {
     // Set the method for the display form to POST
     $this->setMethod('post');
     $this->addAttribs(array('id' => 'addGroup', 'class' => ''));
     $this->setEnctype(Zend_Form::ENCTYPE_MULTIPART);
     $control = new Zend_Form_Element_Hidden('control');
     $control->setValue('addGroup');
     $this->addElement($control);
     // begin inputs
     $name = new Zend_Form_Element_Text('name');
     $name->setAttribs(array('class' => 'text validate[required] rightAdd', 'placeholder' => Zend_Registry::get('translate')->_('admin_category_name')));
     $name->setRequired(true);
     $this->addElement($name);
     // begin inputs
     $color = new Zend_Form_Element_Text('color');
     $color->setAttribs(array('class' => 'text validate[required] rightAdd', 'placeholder' => Zend_Registry::get('translate')->_('admin_color_for_charts')));
     $color->setRequired(true);
     $this->addElement($color);
     // begin inputs
     $type = new Zend_Form_Element_Select('type');
     $options = array('' => Zend_Registry::get('translate')->_('admin_category_select_type'), '0' => Zend_Registry::get('translate')->_('admin_expenses'), '1' => Zend_Registry::get('translate')->_('admin_income'));
     $type->setMultiOptions($options);
     $type->addValidator(new Zend_Validate_InArray(array_keys($options)));
     $type->setAttribs(array('class' => 'select', 'id' => 'type'));
     $type->setRequired(true);
     $this->addElement($type);
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setValue(Zend_Registry::get('translate')->_('admin_add'));
     $submit->setAttribs(array('class' => 'submit'));
     $submit->setIgnore(true);
     $this->addElement($submit);
 }
开发者ID:valizr,项目名称:MMA,代码行数:33,代码来源:Groups.php

示例12: init

 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('action', DOMAIN . 'employmentstatus/edit');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'employmentstatus');
     $id = new Zend_Form_Element_Hidden('id');
     $workcode = new Zend_Form_Element_Text('workcode');
     $workcode->setAttrib('maxLength', 20);
     $workcode->setRequired(true);
     $workcode->addValidator('NotEmpty', false, array('messages' => 'Please enter work short code.'));
     $workcode->addValidator("regex", true, array('pattern' => '/^(?=.*[a-zA-Z])([^ ][a-zA-Z0-9 ]*)$/', 'messages' => array('regexNotMatch' => 'Please enter valid work short code.')));
     $workcodename = new Zend_Form_Element_Select('workcodename');
     $workcodename->setAttrib('class', 'selectoption');
     $workcodename->setRegisterInArrayValidator(false);
     $workcodename->setRequired(true);
     $workcodename->addValidator('NotEmpty', false, array('messages' => 'Please select work code.'));
     $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, $workcode, $workcodename, $description, $submit));
     $this->setElementDecorators(array('ViewHelper'));
 }
开发者ID:uskumar33,项目名称:DeltaONE,代码行数:27,代码来源:employmentstatus.php

示例13: init

 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'emailcontacts');
     $this->setAttrib('action', BASE_URL . 'emailcontacts/add/');
     $id = new Zend_Form_Element_Hidden('id');
     $group_id = new Zend_Form_Element_Select("group_id");
     $group_id->setRegisterInArrayValidator(false);
     $group_id->setRequired(true);
     $group_id->addValidator('NotEmpty', false, array('messages' => 'Please select group.'));
     $business_unit_id = new Zend_Form_Element_Select("business_unit_id");
     $business_unit_id->setRegisterInArrayValidator(false);
     $business_unit_id->setRequired(true);
     $business_unit_id->addValidator('NotEmpty', false, array('messages' => 'Please select business unit.'));
     $business_unit_id->setAttrib('onchange', "bunit_emailcontacts('business_unit_id');");
     //Group Email....
     $grpEmail = new Zend_Form_Element_Text('groupEmail');
     $grpEmail->addFilters(array('StringTrim', 'StripTags'));
     $grpEmail->setRequired(true);
     $grpEmail->addValidator('NotEmpty', false, array('messages' => 'Please enter group email.'));
     $grpEmail->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.')));
     $grpEmail->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_emailcontacts', 'field' => 'groupEmail', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive = 1')));
     $grpEmail->getValidator('Db_NoRecordExists')->setMessage('Group email already exists.');
     // Form Submit .........
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Save');
     $this->addElements(array($id, $group_id, $grpEmail, $submit, $business_unit_id));
     $this->setElementDecorators(array('ViewHelper'));
 }
开发者ID:lukkyrich,项目名称:sentrifugo,代码行数:31,代码来源:emailcontacts.php

示例14: init

 public function init()
 {
     $model_countries = new Locale_Model_Languages();
     $model_t_keys = new Locale_Model_TranslateKeys();
     $key_id = new Zend_Form_Element_Select('key_id');
     $key_id->addValidator(new Zend_Validate_Digits(), true);
     $key_id->setLabel('Key');
     $key_id->setRequired(true);
     $key_id->setMultiOptions($model_t_keys->getIdAndKeyArray(true));
     $this->addElement($key_id);
     $country_id = new Zend_Form_Element_Select('language_id');
     $country_id->addValidator(new Zend_Validate_Digits(), true);
     $country_id->setLabel('Language');
     $country_id->setRequired(true);
     $country_id->setMultiOptions($model_countries->getIdAndNameArray());
     $this->addElement($country_id);
     $value = new My_Form_Element_CKEditor('value');
     $value->setLabel('Translation');
     $value->setDescription('Tags for dynamic values: {1}, {2}, {3}...Double quotes (")are not allowed');
     $this->addElement($value);
     $cancel = new Zend_Form_Element_Button('cancel');
     $cancel->setLabel('Cancel');
     $cancel->setAttrib('class', 'btn btn-gold')->setAttrib('style', 'color:black');
     $cancel->setAttrib("onClick", "window.location = window.location.origin+'/locale/translate-messages/'");
     $this->addElement($cancel);
     $submit = new Zend_Form_Element_Submit('save');
     $submit->setAttrib('class', 'btn btn-primary');
     $submit->setLabel('Confirm');
     $this->setAction('')->setMethod('post')->addElement($submit);
 }
开发者ID:zelimirus,项目名称:yard,代码行数:30,代码来源:TranslateMessages.php

示例15: init

 public function init()
 {
     $this->setName(strtolower(get_class()));
     $this->setMethod("post");
     $oFormName = new Zend_Form_Element_Hidden("form_name");
     $oFormName->setValue(get_class());
     $oFormName->setIgnore(FALSE)->removeDecorator("Label");
     $this->addElement($oFormName);
     $oFileName = new Zend_Form_Element_Select("file_name");
     $oFileName->setLabel("Plik css:");
     $oFileName->setRequired(TRUE);
     $oFileName->addValidator(new Zend_Validate_InArray(array_keys($this->_aAllFile)));
     $oFileName->addMultiOptions($this->_aAllFile);
     $oFileName->setAttrib("class", "valid");
     $this->addElement($oFileName);
     $this->addElement("hash", "csrf_token", array("ignore" => false, "timeout" => 7200));
     $this->getElement("csrf_token")->removeDecorator("Label");
     $oSubmit = $this->createElement("submit", "submit");
     $oSubmit->setLabel("Wczytaj plik");
     $this->addElement($oSubmit);
     $oViewScript = new Zend_Form_Decorator_ViewScript();
     $oViewScript->setViewModule("admin");
     $oViewScript->setViewScript("_forms/_defaultform.phtml");
     $this->clearDecorators();
     $this->setDecorators(array(array($oViewScript)));
     $oElements = $this->getElements();
     foreach ($oElements as $oElement) {
         $oElement->setFilters($this->_aFilters);
         $oElement->removeDecorator("Errors");
     }
 }
开发者ID:lstaszak,项目名称:zf_zk_aleph,代码行数:31,代码来源:FileCss.php


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