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


PHP Zend_Form_Element_Textarea::addValidators方法代码示例

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


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

示例1: init

 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'disabilitydetails');
     $this->setAttrib('action', DOMAIN . 'disabilitydetails/add/');
     $id = new Zend_Form_Element_Hidden('id');
     $user_id = new Zend_Form_Element_Hidden('user_id');
     // Description	or Reason ....
     $desc = new Zend_Form_Element_Textarea('disability_description');
     $desc->setAttrib('rows', 10);
     $desc->setAttrib('cols', 50);
     $desc->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z][a-zA-Z0-9\\-\\,\\.\\&\\:\\"\'\\s]+$/i', 'messages' => array('regexNotMatch' => 'Please start with alphabets.')))));
     //Disability Name ...
     $disability_name = new Zend_Form_Element_Text('disability_name');
     $disability_name->addFilter(new Zend_Filter_StringTrim());
     $disability_name->setAttrib("maxlength", 50);
     $disability_name->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 disability name.')))));
     //Disablity Type
     $disabilityType = new Zend_Form_Element_Select('disability_type');
     $disabilityType->setRegisterInArrayValidator(false);
     $disabilityType->addMultiOptions(array('' => 'Select Disability type', 'blindness and visual impairments' => "Blindness and Visual Impairments", 'health impairments' => "Health Impairments", 'hearing impairments' => "Hearing Impairments", 'learning disabilities' => "Learning Disabilities", 'mental illness or emotional disturbances' => "Mental Illness or Emotional disturbances", 'mobility or orthopedic impairments' => "Mobility or Orthopedic Impairments", 'other impairments' => "Other Impairments", 'speech or language impairments' => "Speech or Language Impairments"));
     $disabilityType->setAttrib('onchange', 'showdisabilityField(this.id)');
     //Other field for disability type....
     $other_disability_type = new Zend_Form_Element_Text('other_disability_type');
     $other_disability_type->addFilter(new Zend_Filter_StringTrim());
     $other_disability_type->setAttrib("maxlength", 50);
     $disabilitytypeVal = Zend_Controller_Front::getInstance()->getRequest()->getParam('disability_type', null);
     if ($disabilitytypeVal == "other impairments") {
         //$other_disability_type->setRequired(true);
         //$other_disability_type->addValidator('NotEmpty', false, array('messages' => 'Please enter any other disability type.'));
     }
     $other_disability_type->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 disability type.')))));
     //Form Submit....
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Save');
     $this->addElements(array($id, $user_id, $disability_name, $disabilityType, $other_disability_type, $desc, $submit));
     $this->setElementDecorators(array('ViewHelper'));
 }
开发者ID:uskumar33,项目名称:DeltaONE,代码行数:40,代码来源:Disabilitydetails.php

示例2: __construct

 public function __construct(GD_Model_Project $project, $options = null, $new_project = false)
 {
     parent::__construct($options);
     $this->setName('projectSettings');
     $project_name = new Zend_Form_Element_Text('name');
     $project_name->setLabel(_r('Project Name'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim');
     $not_empty = new Zend_Validate_NotEmpty();
     $not_empty->setMessage(_r('Please enter the project name'));
     $project_name->addValidators(array($not_empty));
     // if we're adding a new project, we need to make sure it's unique
     if ($new_project) {
         $unique_name = new GD_Validate_UniqueName();
         $project_name->addValidators(array($unique_name));
     }
     $git_validator = new GD_Validate_GitUrl();
     $repository_url = new Zend_Form_Element_Text('repositoryUrl');
     $repository_url->setLabel(_r('Repository URL'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim');
     $not_empty = new Zend_Validate_NotEmpty();
     $not_empty->setMessage(_r('Please enter the Repository URL'));
     $repository_url->addValidators(array($not_empty, $git_validator));
     $deployment_branch = new Zend_Form_Element_Text('deploymentBranch');
     $deployment_branch->setLabel(_r('Deployment Branch'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim');
     $not_empty = new Zend_Validate_NotEmpty();
     $not_empty->setMessage(_r('Please enter the name of the Deployment Branch'));
     $deployment_branch->addValidators(array($not_empty));
     if (!$new_project) {
         $deployment_branch->addValidator(new GD_Validate_GitBranch($project));
     }
     $public_key = new Zend_Form_Element_Textarea('publicKey');
     $public_key->setLabel(_r('Public Key'))->setRequired(false)->setAttrib('readonly', 'readonly');
     $not_empty = new Zend_Validate_NotEmpty();
     $not_empty->setMessage(_r('Please enter the Public Key'));
     $public_key->addValidators(array($not_empty));
     $submit = new Zend_Form_Element_Image('btn_submit');
     $submit->setImage('/images/buttons/small/save-changes.png');
     $submit->class = "processing_btn size_small";
     $this->addElements(array($project_name, $repository_url, $deployment_branch, $public_key, $submit));
 }
开发者ID:robertbasic,项目名称:godeploy,代码行数:38,代码来源:ProjectSettings.php


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