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


PHP Zend_Validate_NotEmpty::setMessage方法代码示例

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


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

示例1: init

 public function init()
 {
     /* Form Elements & Other Definitions Here ... */
     // TODO setMethod
     $element = new Zend_Form_Element_Text('prenom');
     $element->setLabel('Prénom')->setRequired();
     $validator = new Zend_Validate_NotEmpty();
     $validator->setMessage('Le prénom est obligatoire', Zend_Validate_NotEmpty::IS_EMPTY);
     $element->addValidator($validator);
     $validator = new Zend_Validate_StringLength();
     $validator->setMax(40);
     $element->addValidator($validator);
     $filter = new Zend_Filter_StringTrim();
     $element->addFilter($filter);
     $this->addElement($element);
     $element = new Zend_Form_Element_Text('nom');
     $element->setLabel('Nom')->setRequired();
     $validator = new Zend_Validate_NotEmpty();
     $validator->setMessage('Le nom est obligatoire', Zend_Validate_NotEmpty::IS_EMPTY);
     $element->addValidator($validator);
     $this->addElement($element);
     $element = new Zend_Form_Element_Text('email');
     $element->setLabel('Email');
     $this->addElement($element);
     $element = new Zend_Form_Element_Text('telephone');
     $element->setLabel('Téléphone');
     $this->addElement($element);
 }
开发者ID:bioub,项目名称:Formation_ZF1_Viveris_2016_02,代码行数:28,代码来源:Contact.php

示例2: array

 /**
  * @group ZF-11267
  * If we pass in a validator instance that has a preset custom message, this
  * message should be used.
  */
 function testIfCustomMessagesOnValidatorInstancesCanBeUsed()
 {
     // test with a Digits validator
     require_once 'Zend/Validate/Digits.php';
     require_once 'Zend/Validate/NotEmpty.php';
     $data = array('field1' => 'invalid data');
     $customMessage = 'Hey, that\'s not a Digit!!!';
     $validator = new Zend_Validate_Digits();
     $validator->setMessage($customMessage, 'notDigits');
     $this->assertFalse($validator->isValid('foo'), 'standalone validator thinks \'foo\' is a valid digit');
     $messages = $validator->getMessages();
     $this->assertSame($messages['notDigits'], $customMessage, 'stanalone validator does not have custom message');
     $validators = array('field1' => $validator);
     $input = new Zend_Filter_Input(null, $validators, $data);
     $this->assertFalse($input->isValid(), 'invalid input is valid');
     $messages = $input->getMessages();
     $this->assertSame($messages['field1']['notDigits'], $customMessage, 'The custom message is not used');
     // test with a NotEmpty validator
     $data = array('field1' => '');
     $customMessage = 'You should really supply a value...';
     $validator = new Zend_Validate_NotEmpty();
     $validator->setMessage($customMessage, 'isEmpty');
     $this->assertFalse($validator->isValid(''), 'standalone validator thinks \'\' is not empty');
     $messages = $validator->getMessages();
     $this->assertSame($messages['isEmpty'], $customMessage, 'stanalone NotEmpty validator does not have custom message');
     $validators = array('field1' => $validator);
     $input = new Zend_Filter_Input(null, $validators, $data);
     $this->assertFalse($input->isValid(), 'invalid input is valid');
     $messages = $input->getMessages();
     $this->assertSame($messages['field1']['isEmpty'], $customMessage, 'For the NotEmpty validator the custom message is not used');
 }
开发者ID:ThorstenSuckow,项目名称:conjoon,代码行数:36,代码来源:InputTest.php

示例3: init

 public function init()
 {
     /* Form Elements & Other Definitions Here ... */
     $element = new Zend_Form_Element_Text('login');
     $element->setLabel('Login')->setRequired();
     $validator = new Zend_Validate_NotEmpty();
     $validator->setMessage('Le login est obligatoire', Zend_Validate_NotEmpty::IS_EMPTY);
     $element->addValidator($validator);
     $validator = new Zend_Validate_StringLength();
     $validator->setMax(40);
     $element->addValidator($validator);
     $filter = new Zend_Filter_StringTrim();
     $element->addFilter($filter);
     $this->addElement($element);
     $element = new Zend_Form_Element_Password('password');
     $element->setLabel('Mot de passe')->setRequired();
     $validator = new Zend_Validate_NotEmpty();
     $validator->setMessage('Le mot de passe est obligatoire', Zend_Validate_NotEmpty::IS_EMPTY);
     $element->addValidator($validator);
     $validator = new Zend_Validate_StringLength();
     $validator->setMax(40);
     $element->addValidator($validator);
     $filter = new Zend_Filter_StringTrim();
     $element->addFilter($filter);
     $this->addElement($element);
 }
开发者ID:bioub,项目名称:Formation_ZF1_Viveris_2016_02,代码行数:26,代码来源:Login.php

示例4: __construct

 public function __construct($options = null)
 {
     $baseDir = $options['baseDir'];
     $pageID = $options['pageID'];
     parent::__construct($options);
     /****************************************/
     // PARAMETERS
     /****************************************/
     // select box category (Parameter #1)
     $blockCategory = new Zend_Form_Element_Select('Param1');
     $blockCategory->setLabel('Catégorie d\'évènement de ce bloc')->setAttrib('class', 'largeSelect');
     $categories = new Categories();
     $select = $categories->select()->setIntegrityCheck(false)->from('Categories')->join('CategoriesIndex', 'C_ID = CI_CategoryID')->where('C_ModuleID = ?', 7)->where('CI_LanguageID = ?', Zend_Registry::get("languageID"))->order('CI_Title');
     $categoriesArray = $categories->fetchAll($select);
     foreach ($categoriesArray as $category) {
         $blockCategory->addMultiOption($category['C_ID'], $category['CI_Title']);
     }
     // number of news to show in front-end (Parameter #2)
     $at_least_one = new Zend_Validate_GreaterThan('0');
     $at_least_one->setMessage('Vous devez afficher au moins un événement.');
     $not_null = new Zend_Validate_NotEmpty();
     $not_null->setMessage($this->getView()->getCibleText('validation_message_empty_field'));
     $blockNewsMax = new Zend_Form_Element_Text('Param2');
     $blockNewsMax->setLabel('Nombre d\'évènement à afficher')->setRequired(true)->setValue('1')->addValidator($not_null, true)->addValidator($at_least_one, true)->setAttrib('class', 'smallTextInput');
     // show the breif text in front-end (Parameter #3)
     $blockShowBrief = new Zend_Form_Element_Checkbox('Param3');
     $blockShowBrief->setLabel('Afficher le texte bref');
     $blockShowBrief->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox'))));
     $this->addElements(array($blockCategory, $blockNewsMax, $blockShowBrief));
     $this->removeDisplayGroup('parameters');
     $this->addDisplayGroup(array('Param999', 'Param1', 'Param2', 'Param3'), 'parameters');
     $parameters = $this->getDisplayGroup('parameters');
     //$parameters->setLegend($this->_view->getCibleText('form_parameters_fieldset'));
 }
开发者ID:anunay,项目名称:stentors,代码行数:34,代码来源:FormBlockEvents.php

示例5: init

 public function init()
 {
     $this->setMethod('post');
     //The password element.
     $passwordElement = new Zend_Form_Element_Password('password');
     $passwordElement->setRequired(true);
     $passwordElement->setLabel('New Password:');
     $passwordElement->addValidator(new Zend_Validate_PasswordStrength());
     $validator = new Zend_Validate_Identical();
     $validator->setToken('confirm_password');
     $validator->setMessage('Passwords are not the same', Zend_Validate_Identical::NOT_SAME);
     $passwordElement->addValidator($validator);
     $this->addElement($passwordElement);
     //The confirm password element.
     $confirmPasswordElement = new Zend_Form_Element_Password('confirm_password');
     $confirmPasswordElement->setRequired(true);
     $confirmPasswordElement->setLabel('Confirm New Password:');
     $validator = new Zend_Validate_NotEmpty();
     $validator->setMessage('Please confirm your password');
     $confirmPasswordElement->addValidator($validator);
     $this->addElement($confirmPasswordElement);
     // Security question & answer
     $this->addElement('select', 'security_question', array('label' => 'Security Question', 'required' => true, 'multiOptions' => array(0 => 'Please select'), 'decorators' => array(array('ViewHelper', array('escape' => false)), array('Label', array('escape' => false)))));
     $this->addElement('text', 'security_answer', array('label' => 'Answer', 'required' => true, 'filters' => array('StringTrim'), 'attribs' => array('data-ctfilter' => 'yes')));
     $this->addElement('hidden', 'instruction', array('required' => false));
     $this->addElement('submit', 'submit', array('ignore' => true, 'label' => 'Save', 'class' => 'button'));
     $this->setElementDecorators(array('ViewHelper', 'Label', 'Errors', array('HtmlTag', array('tag' => 'div'))));
     // Set up the decorator on the form and add in decorators which are removed
     $this->addDecorator('FormElements')->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'form_section one-col'))->addDecorator('Form');
     $element = $this->getElement('submit');
     $element->removeDecorator('label');
     // Remove the label from the submit button
 }
开发者ID:AlexEvesDeveloper,项目名称:hl-stuff,代码行数:33,代码来源:Save.php

示例6: formValidator

	public function formValidator($form)
	{
		$emptyValidator = new Zend_Validate_NotEmpty();
		$emptyValidator->setMessage(General_Models_Text::$text_notEmpty);
		$form->getElement('username')->setAllowEmpty(false)
								->addValidator($emptyValidator);
		$form->getElement('password')->setAllowEmpty(false)
								->addValidator($emptyValidator);
		return $form;
	}
开发者ID:robliuning,项目名称:Luckyrabbit,代码行数:10,代码来源:LoginMapper.php

示例7: init

 public function init()
 {
     // Set request method
     $this->setMethod('post');
     // Email entry
     $this->addElement('span', 'email', array('label' => 'Email address', 'required' => false, 'filters' => array('StringTrim'), 'class' => 'formvalue', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter your email address'))))));
     // Modify email error messages & add validator
     $emailValidator = new Zend_Validate_EmailAddress();
     $emailValidator->setMessages(array(Zend_Validate_EmailAddress::INVALID_HOSTNAME => "Domain name invalid in email address", Zend_Validate_EmailAddress::INVALID_FORMAT => "Invalid email address"));
     $this->getElement('email')->addValidator($emailValidator);
     //The password element.
     $passwordElement = new Zend_Form_Element_Password('password');
     $passwordElement->setRequired(true);
     $passwordElement->setLabel('Create your password');
     $passwordElement->setOptions(array('data-noAjaxValidate' => '1'));
     $passwordElement->addValidator(new Zend_Validate_PasswordStrength());
     $validator = new Zend_Validate_Identical();
     $validator->setToken('confirm_password');
     $validator->setMessage('Passwords are not the same', Zend_Validate_Identical::NOT_SAME);
     $passwordElement->addValidator($validator);
     $this->addElement($passwordElement);
     //The confirm password element.
     $confirmPasswordElement = new Zend_Form_Element_Password('confirm_password');
     $confirmPasswordElement->setRequired(true);
     $confirmPasswordElement->setLabel('Re-enter password');
     $confirmPasswordElement->setOptions(array('data-noAjaxValidate' => '1'));
     $validator = new Zend_Validate_NotEmpty();
     $validator->setMessage('Please confirm your password');
     $confirmPasswordElement->addValidator($validator);
     $this->addElement($confirmPasswordElement);
     // Security question & answer
     $securityQuestionModel = new Datasource_Core_SecurityQuestion();
     $securityQuestionOptions = array(0 => '- Please Select -');
     foreach ($securityQuestionModel->getOptions() as $option) {
         $securityQuestionOptions[$option['id']] = $option['question'];
     }
     $this->addElement('select', 'security_question', array('label' => 'Security Question', 'required' => false, 'multiOptions' => $securityQuestionOptions, 'decorators' => array(array('ViewHelper', array('escape' => false)), array('Label', array('escape' => false)))));
     /* Value no longer mandatory, Redmine #11873
             $questionElement = $this->getElement('security_question');
             $validator = new Zend_Validate_GreaterThan(array('min'=> 0));
             $validator->setMessage('You must select a security question');
             $questionElement->addValidator($validator);
     */
     $this->addElement('text', 'security_answer', array('label' => 'Answer', 'required' => false, 'filters' => array('StringTrim')));
     // Set custom subform decorator - this is the default and gets overridden by view scripts in the tenants' and landlords' Q&Bs
     $this->setDecorators(array(array('ViewScript', array('viewScript' => 'subforms/register.phtml'))));
     // Set element decorators
     $this->setElementDecorators(array(array('ViewHelper', array('escape' => false)), array('Label', array('escape' => false))));
     // Grab view and add the client-side password validation JavaScript into the page head
     $view = Zend_Controller_Front::getInstance()->getParam('bootstrap')->getResource('view');
     $view->headScript()->appendFile('/assets/common/js/passwordValidation.js', 'text/javascript');
 }
开发者ID:AlexEvesDeveloper,项目名称:hl-stuff,代码行数:52,代码来源:Register.php

示例8: init

 /**
  * Initialise the form
  * 
  * @todo Validation
  * @return void 
  */
 public function init()
 {
     // Set request method
     $this->setMethod('POST');
     // Add title element
     $this->addElement('select', 'title', array('label' => 'Title', 'required' => true, 'multiOptions' => TenantsInsuranceQuote_Form_Subforms_PersonalDetails::$titles, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select your title', 'notEmptyInvalid' => 'Please select your title')))), 'class' => 'form-control'));
     // Add first name element
     $this->addElement('text', 'first_name', array('label' => 'First name', 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter your first name', 'notEmptyInvalid' => 'Please enter your first name'))), array('regex', true, array('pattern' => '/^[a-z\\-\\ \']{2,}$/i', 'messages' => 'First name must contain at least two alphabetic characters and only basic punctuation (hyphen, space and single quote)'))), 'class' => 'form-control'));
     // Add last name element
     $this->addElement('text', 'last_name', array('label' => 'Last name', 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter your last name'))), array('regex', true, array('pattern' => '/^[a-z\\-\\ \']{2,}$/i', 'messages' => 'Last name must contain at least two alphabetic characters and only basic punctuation (hyphen, space and single quote)'))), 'class' => 'form-control'));
     // Email element
     $this->addElement('text', 'email', array('label' => 'Email Address', 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Email address is required')))), 'class' => 'form-control'));
     // Modify email error messages & add validator
     $emailValidator = new Zend_Validate_EmailAddress();
     $emailValidator->setMessages(array(Zend_Validate_EmailAddress::INVALID_HOSTNAME => "Domain name invalid in email address", Zend_Validate_EmailAddress::INVALID_FORMAT => "Invalid email address"));
     $this->getElement('email')->addValidator($emailValidator);
     //The password element.
     $passwordElement = new Zend_Form_Element_Password('password', array('validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Password is required')))), 'class' => 'form-control'));
     $passwordElement->setRequired(true);
     $passwordElement->setLabel('Password');
     $passwordElement->setAttribs(array('class' => 'form-control'));
     $passwordElement->addValidator(new Zend_Validate_PasswordStrength());
     $validator = new Zend_Validate_Identical();
     $validator->setToken('confirm_password');
     $validator->setMessage('Passwords are not the same', Zend_Validate_Identical::NOT_SAME);
     $passwordElement->addValidator($validator);
     $this->addElement($passwordElement);
     //The confirm password element.
     $confirmPasswordElement = new Zend_Form_Element_Password('confirm_password');
     $confirmPasswordElement->setRequired(true);
     $confirmPasswordElement->setLabel('Confirm Password');
     $confirmPasswordElement->setAttribs(array('class' => 'form-control'));
     $validator = new Zend_Validate_NotEmpty();
     $validator->setMessage('Please confirm your password');
     $confirmPasswordElement->addValidator($validator);
     $this->addElement($confirmPasswordElement);
     // Security question & answer
     $this->addElement('select', 'security_question', array('label' => 'Security Question', 'required' => true, 'multiOptions' => array('' => 'Please select'), 'decorators' => array(array('ViewHelper', array('escape' => false)), array('Label', array('escape' => false))), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Security question is required')))), 'class' => 'form-control'));
     $this->addElement('text', 'security_answer', array('label' => 'Answer', 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Security answer is required')))), 'class' => 'form-control'));
     $this->addElement('hidden', 'refno', array('required' => false, 'class' => 'noalt'));
     // Add the submit button
     $this->addElement('submit', 'submit', array('ignore' => true, 'label' => 'Register', 'class' => 'btn btn-primary pull-right'));
     // Set up the element decorators
     $this->setElementDecorators(array('ViewHelper', 'Label', 'Errors'));
     // Set up the decorator on the form and add in decorators which are removed
     $this->addDecorator('FormElements')->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'form_section'))->addDecorator('Form');
     // Remove the label from the submit button
     $element = $this->getElement('submit');
     $element->removeDecorator('label');
     $this->getElement('refno')->removeDecorator('HtmlTag');
 }
开发者ID:AlexEvesDeveloper,项目名称:hl-stuff,代码行数:57,代码来源:Register.php

示例9: init

 public function init()
 {
     // валидаторы
     $alnum = new Zend_Validate_Alnum();
     $alnum->setMessage($this->messageAlnum);
     $notEmpty = new Zend_Validate_NotEmpty();
     $notEmpty->setMessage($this->notEmpty, "isEmpty");
     // создаем форму
     $this->setName('interview');
     $this->setAttribs(array('method' => "post", "class" => "form-horizontal"));
     $this->setDecorators(array('FormElements', 'Form'));
     $this->createFormElements($this, $this->elementsForm());
     return $this;
 }
开发者ID:MichaelGogeshvili,项目名称:strap,代码行数:14,代码来源:FormCyprus.php

示例10: init

 /**
  * Initialise the form
  * 
  * @todo Validation
  * @return void 
  */
 public function init()
 {
     // Set request method
     $this->setMethod('POST');
     // Add title element
     $this->addElement('text', 'title', array('label' => 'Title'));
     // Add first name element
     $this->addElement('text', 'first_name', array('label' => 'First name'));
     // Add last name element
     $this->addElement('text', 'last_name', array('label' => 'Last name'));
     $this->addElement('password', 'existing_password', array('required' => true, 'filters' => array('StringTrim'), 'class' => 'form-control'));
     // Email element
     $this->addElement('text', 'email', array('label' => 'Email Address'));
     //The password element.
     $passwordElement = new Zend_Form_Element_Password('password');
     $passwordElement->setRequired(false);
     // New password is not required to update options
     $passwordElement->addValidator(new Zend_Validate_PasswordStrength());
     $passwordElement->setAttribs(array('class' => 'form-control'));
     $validator = new Zend_Validate_Identical();
     $validator->setToken('confirm_password');
     $validator->setMessage('Passwords are not the same', Zend_Validate_Identical::NOT_SAME);
     $passwordElement->addValidator($validator);
     $this->addElement($passwordElement);
     //The confirm password element.
     $confirmPasswordElement = new Zend_Form_Element_Password('confirm_password');
     $confirmPasswordElement->setRequired(false);
     // New password is not required to update options
     $confirmPasswordElement->setAttribs(array('class' => 'form-control'));
     $validator = new Zend_Validate_NotEmpty();
     $validator->setMessage('Please confirm your password');
     $confirmPasswordElement->addValidator($validator);
     $this->addElement($confirmPasswordElement);
     // Security question & answer
     $this->addElement('select', 'security_question', array('required' => true, 'multiOptions' => array(0 => 'Please select'), 'decorators' => array(array('ViewHelper', array('escape' => false)), array('Label', array('escape' => false))), 'class' => 'form-control'));
     $this->addElement('text', 'security_answer', array('required' => true, 'filters' => array('StringTrim'), 'class' => 'form-control'));
     // Add the submit button
     $this->addElement('submit', 'submit', array('ignore' => true, 'class' => 'btn btn-primary pull-right', 'label' => 'Save'));
     // Set up the element decorators
     $this->setElementDecorators(array('ViewHelper', 'Label', 'Errors', array('HtmlTag', array('tag' => 'div'))));
     // Set up the decorator on the form and add in decorators which are removed
     $this->addDecorator('FormElements')->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'form_section one-col'))->addDecorator('Form');
     // Set custom subform decorator
     $this->setDecorators(array(array('ViewScript', array('viewScript' => 'subforms/edit-account.phtml'))));
     // Remove the label from the submit button
     $element = $this->getElement('submit');
     $element->removeDecorator('label');
 }
开发者ID:AlexEvesDeveloper,项目名称:hl-stuff,代码行数:54,代码来源:EditAccount.php

示例11: __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

示例12: __construct

 public function __construct($options = null)
 {
     parent::__construct($options);
     $this->setName('login_form')->setAction('/auth/login')->setMethod('post');
     $username = new Zend_Form_Element_Text('username');
     $username->setLabel(_r('Username'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim');
     $not_empty = new Zend_Validate_NotEmpty();
     $not_empty->setMessage(_r('Please enter your User Name'));
     $username->addValidators(array($not_empty));
     $password = new Zend_Form_Element_Password('password');
     $password->setLabel(_r('Password'))->setRequired(true)->addFilter('StripTags');
     $not_empty = new Zend_Validate_NotEmpty();
     $not_empty->setMessage(_r('Please enter your Password'));
     $password->addValidators(array($not_empty));
     $submit = new Zend_Form_Element_Image('btn_submit');
     $submit->setImage('/images/buttons/small/login.png');
     $this->addElements(array($username, $password, $submit));
 }
开发者ID:rodrigorm,项目名称:godeploy,代码行数:18,代码来源:Login.php

示例13: __construct

 public function __construct()
 {
     // Validators --------------------------
     $notEmpty = new Zend_Validate_NotEmpty(array(true));
     $notEmpty->setMessage($this->_errorMessages['isEmpy']);
     $digits = new Zend_Validate_Digits();
     $digits->setMessage($this->_errorMessages['digits']);
     $emailValidator = new Zend_Validate_EmailAddress();
     $emailValidator->setMessage($this->_errorMessages['emailValidator']);
     $foneValidator = new Zend_Validate_StringLength();
     $foneValidator->setMin(8);
     $foneValidator->setMessage($this->_errorMessages['foneValidator']);
     //--------------------------------------
     $nome = new Zend_Form_Element_Text('nome');
     $nome->setAttrib('class', 'form-control');
     $nome->setRequired(true);
     $nome->addValidator($notEmpty, true);
     //--------------------------------------------------------
     $fone = new Zend_Form_Element_Text('fone');
     $fone->setAttrib('class', 'form-control');
     $fone->setRequired(true);
     $fone->addValidator($notEmpty, true);
     $fone->addValidator($digits, true);
     $fone->addValidator($foneValidator, true);
     //--------------------------------------------------------
     $email = new Zend_Form_Element_Text('email');
     $email->setAttrib('class', 'form-control');
     $email->setRequired(true);
     $email->addValidator($notEmpty, true);
     $email->addValidator($emailValidator, true);
     //--------------------------------------------------------
     $mensagem = new Zend_Form_Element_Textarea('mensagem');
     $mensagem->setAttrib('class', 'form-control');
     $mensagem->setAttrib('cols', 30);
     $mensagem->setAttrib('rows', 10);
     $mensagem->setRequired(true);
     $mensagem->addValidator($notEmpty, true);
     //--------------------------------------------------------
     $this->addElement($nome);
     $this->addElement($fone);
     $this->addElement($email);
     $this->addElement($mensagem);
     $this->setElementDecorators(array('ViewHelper', 'Errors'));
 }
开发者ID:elvisdandrea,项目名称:esselence,代码行数:44,代码来源:FaleConoscoForm.php

示例14: init

 public function init()
 {
     // валидаторы
     $alnum = new Zend_Validate_Alnum();
     $alnum->setMessage($this->messageAlnum);
     $notEmpty = new Zend_Validate_NotEmpty();
     $notEmpty->setMessage($this->notEmpty, "isEmpty");
     // фильтры
     $stringTrim = new Zend_Filter_StringTrim();
     $stripTags = new Zend_Filter_StripTags();
     // добавляем элементы формы в массив, потом будем собирать форму в цыкле
     $elementsForm = array('surname' => array('type' => 'text', 'label' => 'ФИО', 'attribs' => array('class' => 'span12', 'placeholder' => 'Фамилия')), 'name' => array('label' => 'Имя', 'attribs' => array('class' => 'span12', 'placeholder' => 'Имя')), 'patronymic' => array('label' => 'Отчество', 'attribs' => array('class' => 'span12', 'placeholder' => 'Отчество')), 'sex' => array('type' => 'select', 'label' => 'Пол', 'multiOptions' => array('male' => 'Мужской', 'female' => 'Женский')), 'birthday' => array('label' => 'Дата Рождения', 'attribs' => $this->datepicker), 'maidenName' => array('label' => 'Девичья фамилия (если менялась)'), 'placeOfBirth' => array('label' => 'Место рождения (по паспорту)'), 'oldCountry' => array('label' => 'Страна рождения', 'attribs' => array('class' => 'span12')), 'nationality' => array('label' => 'Текущее гражданство', 'attribs' => array('class' => 'span12')), 'citizenship' => array('label' => 'Гражданство (при рождении)', 'attribs' => array('class' => 'span12')), 'FIFather' => array('label' => 'И.Ф Отца', 'attribs' => array('class' => 'span12')), 'FIMother' => array('label' => 'И.Ф Матери', 'attribs' => array('class' => 'span12')), 'maritalStatus' => array('type' => 'select', 'label' => 'Семейное Положение', 'multiOptions' => array('married' => 'женат/замужем', 'single' => 'холост/незамужем')), 'addressOfRegistration' => array('label' => 'Адрес (по прописке)'), 'telephoneNumber' => array('label' => 'Номер телефона'), 'profession' => array('label' => 'Профессия'), 'refsCompany' => array('label' => 'Назв. фирмы'), 'cityWhereTriesFirm' => array('label' => 'Город, где находится фирма'), 'workPhone' => array('label' => 'Раб телефон'), 'firstBorderCrossing' => array('label' => 'Первый пункт пересечения границы'), 'foreignPassport' => array('type' => 'text', 'label' => 'Данные заграничного пасспорта', 'attribs' => array('class' => 'span12', 'placeholder' => 'Серия и номер')), 'startDate' => array('type' => 'text', 'label' => 'Дата выдачи', 'attribs' => array('class' => 'span12 datepicker', 'readonly' => '', 'placeholder' => 'Дата выдачи')), 'endDate' => array('type' => 'text', 'label' => 'Дата окончания', 'attribs' => array('class' => 'span12 datepicker', 'readonly' => '', 'placeholder' => 'Дата окончания')), 'issued' => array('type' => 'text', 'label' => 'Кем выдан', 'attribs' => array('class' => 'span12', 'placeholder' => 'Кем выдан')), 'schengenVisasLast' => array('type' => 'textarea', 'label' => 'Шенгенские визы за последние 3 года', 'attribs' => $this->textareaAttribs), 'serNumPassport' => array('label' => 'Серия, номер гражданского паспорта'), 'addressActual' => array('label' => 'Адрес (фактический)'), 'theseSpouse' => array('type' => 'textarea', 'label' => 'Данные супруга(и)Девичья фамилия, дата рождения, место рождения', 'attribs' => $this->textareaAttribs), 'forMinors' => array('type' => 'textarea', 'label' => 'Для несовершеннолетних: ФИО, адрес и гражданство законного представителя', 'attribs' => $this->textareaAttribs), 'whoPays' => array('type' => 'select', 'label' => 'Кто оплачивает поездку', 'multiOptions' => array('myself' => 'Сам турист', 'sponsor' => 'Спонсор')), 'sponsor' => array('label' => 'Кто является спонсором'));
     // создаем форму
     $this->setName('interview');
     $this->setAttribs(array('method' => "post", "class" => "form-horizontal"));
     $this->setDecorators(array('FormElements', 'Form'));
     $this->createFormElements($this, $elementsForm, $this->elementDecorators, $this->buttonLabel, $this->buttonDecorators);
     return $this;
 }
开发者ID:MichaelGogeshvili,项目名称:strap,代码行数:19,代码来源:Test.php

示例15: init

 public function init()
 {
     $dbValidator = new Zend_Validate_Db_RecordExists(array('table' => 'users', 'field' => 'login'));
     $dbValidator->setMessage('Пользователя с таким именем нет в наших записях.');
     $alnum = new Zend_Validate_Alnum();
     $alnum->setMessage('Только буквы и цыфры!');
     $notEmpty = new Zend_Validate_NotEmpty();
     $notEmpty->setMessage('Поле обязательно для заполнения', 'isEmpty');
     $stringLength = new Zend_Validate_StringLength(array('min' => 3));
     $stringLength->setMessage('Длина поля должна быть больше трех символов.');
     if (!empty($_GET['referer'])) {
         $referer = $_GET['referer'];
     } else {
         $referer = '/';
     }
     $elementsForm = array('login' => array('type' => 'text', 'label' => 'Введите логин'), 'password' => array('type' => 'text', 'label' => 'Введите пароль', 'validators' => array('alnum' => $alnum, 'notEmpty' => $notEmpty, 'dbValidator' => $dbValidator, 'stringLength' => $stringLength)), 'redirect' => array('type' => 'hidden', 'attribs' => array('value' => $referer)));
     // имя формы;
     $this->setName('auth');
     $this->setAttribs(array('method' => "post", "role" => "form", "class" => "form-horizontal"));
     $this->createFormElements($this, $elementsForm, $this->elementDecorators, 'Войти', $this->buttonDecorators);
     return $this;
 }
开发者ID:MichaelGogeshvili,项目名称:strap,代码行数:22,代码来源:Auth.php


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