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


PHP Zend_Validate_EmailAddress::setMessages方法代码示例

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


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

示例1: init

 public function init()
 {
     // contactnameElement
     $this->addElement('text', 'contactname', array('label' => 'Please give us a head office contact name', 'required' => false, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please give us a head office contact name', 'notEmptyInvalid' => 'Invalid contact name'))))));
     // telephone_numberl Element
     $this->addElement('text', 'telephone_number', array('label' => 'Head office phone number', 'required' => false, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Enter your Head Office telephone number', 'notEmptyInvalid' => 'Invalid UK telephone number for Head Office'))))));
     $phoneValidator = new Zend_Validate_TelephoneNumber();
     $phoneValidator->setMessages(array(Zend_Validate_TelephoneNumber::INVALID => "Invalid UK telephone number for Head Office"));
     $this->getElement('telephone_number')->addValidator($phoneValidator);
     // head_office_email_address Email Element
     $this->addElement('text', 'head_office_email_address', array('label' => 'Head office email address', 'required' => false, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Enter your head office email address', 'notEmptyInvalid' => 'Head office email address is invalid'))))));
     $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('head_office_email_address')->addValidator($emailValidator);
     // head_office_fax_number Element
     $this->addElement('text', 'head_office_fax_number', array('label' => 'Head office fax number', 'required' => false, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Enter your Head Office fax number', 'notEmptyInvalid' => 'Head Office Fax number is not a valid UK telephone number'))))));
     $faxValidator = new Zend_Validate_TelephoneNumber();
     $faxValidator->setMessages(array(Zend_Validate_TelephoneNumber::INVALID => "Head Office Fax number is not a valid UK telephone number"));
     $this->getElement('head_office_fax_number')->addValidator($faxValidator);
     // Strip all tags to prevent XSS errors
     $this->setElementFilters(array('StripTags'));
     // Set custom subform decorator
     $this->setDecorators(array(array('ViewScript', array('viewScript' => 'subforms/head-office.phtml'))));
     $this->setElementDecorators(array(array('ViewHelper', array('escape' => false)), array('Label', array('escape' => false))));
 }
开发者ID:AlexEvesDeveloper,项目名称:hl-stuff,代码行数:25,代码来源:HeadOffice.php

示例2: init

 public function init()
 {
     // Type of organisation Element
     $this->addElement('select', 'organisation_type', array('label' => 'What sort of organisation are you?', 'required' => true, 'multiOptions' => array('' => '--- Please select ---', LettingAgents_Object_CompanyTypes::LimitedCompany => 'Limited Company', LettingAgents_Object_CompanyTypes::Partnership => 'Partnership', LettingAgents_Object_CompanyTypes::SoleTrader => 'Sole Trader', LettingAgents_Object_CompanyTypes::LimitedLiabilityPartnership => 'Limited liability partnership'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'What sort of organisation are you?', 'notEmptyInvalid' => 'What sort of organisation are you?'))))));
     // date_firm_established Element
     $this->addElement('text', 'date_established', array('id' => 'theDate', 'label' => 'When were you established?', 'required' => false, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'When were you established?', 'notEmptyInvalid' => 'You have entered an invalid date for when were you established?'))))));
     // Append Javascripts
     //Grab view and add the date picker JavaScript files into the page head
     $view = Zend_Controller_Front::getInstance()->getParam('bootstrap')->getResource('view');
     $view->headLink()->appendStylesheet('/assets/cms/css/datePicker.css', 'screen');
     $view->headScript()->appendFile('/assets/vendor/js/date.js', 'text/javascript')->appendFile('/assets/cms/js/jquery.datePicker.js', 'text/javascript')->appendFile('/assets/cms/js/letting-agents/DatePicker.js', 'text/javascript');
     // is_associated Element
     $this->addElement('select', 'is_associated', array('label' => 'Is your company associated with any other letting business?', 'required' => true, 'multiOptions' => array('' => '--- Please select ---', '1' => 'Yes', '0' => 'No'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Is your company associated with any other company?', 'notEmptyInvalid' => 'Is your company associated with any other company?'))))));
     // if_yes Element
     $this->addElement('text', 'associated_text', array('label' => 'If yes please state', 'required' => false, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'If yes please state', 'notEmptyInvalid' => 'If yes please state'))))));
     // contact_name Element
     $this->addElement('text', 'contact_name', array('label' => 'Your contact name', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Enter a contact name', 'notEmptyInvalid' => 'Invalid entry for contact name'))))));
     // contact_name Element
     $this->addElement('text', 'contact_number', array('label' => 'Your phone number', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'A uk phone number is required', 'notEmptyInvalid' => 'Enter a valid uk phone number'))))));
     $phoneValidator = new Zend_Validate_TelephoneNumber();
     $phoneValidator->setMessages(array(Zend_Validate_TelephoneNumber::INVALID => "Enter a valid uk phone number"));
     $this->getElement('contact_number')->addValidator($phoneValidator);
     // General Email Element
     $this->addElement('text', 'general_email', array('label' => 'Your general email address', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'A general email address is required', 'notEmptyInvalid' => 'Enter a valid email address for the general email address'))))));
     $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('general_email')->addValidator($emailValidator);
     // Strip all tags to prevent XSS errors
     $this->setElementFilters(array('StripTags'));
     // Set custom subform decorator
     $this->setDecorators(array(array('ViewScript', array('viewScript' => 'subforms/personal-details.phtml'))));
     $this->setElementDecorators(array(array('ViewHelper', array('escape' => false)), array('Label', array('escape' => false))));
 }
开发者ID:AlexEvesDeveloper,项目名称:hl-stuff,代码行数:33,代码来源:PersonalDetails.php

示例3: init

 /**
  * Create lost login (password retrieval) form.
  *
  * @return void
  */
 public function init()
 {
     // Invoke the agent user manager
     $agentUserManager = new Manager_Core_Agent_User();
     // Create array of possible security questions
     $securityQuestions = array('' => '--- please select ---');
     $securityQuestions += $agentUserManager->getUserSecurityAllQuestions();
     $this->setMethod('post');
     // Add agent scheme number element
     $this->addElement('text', 'agentschemeno', array('label' => 'Agent Scheme Number', 'required' => false, 'filters' => array('Digits'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter your Agent Scheme Number', 'notEmptyInvalid' => 'Please enter your Letting Agent Scheme Number'))), array('regex', true, array('pattern' => '/^\\d{5,}$/', 'messages' => 'Agent Scheme Number must contain at least 5 digits')))));
     // Add username element
     $this->addElement('text', 'username', array('label' => 'Username', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter your username', 'notEmptyInvalid' => 'Please enter your username'))), array('regex', true, array('pattern' => '/^[a-z0-9]{6,64}$/i', 'messages' => 'Username must contain between 6 and 64 alphanumeric characters')))));
     // Add password element
     $this->addElement('password', 'password', array('label' => 'Password', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter your password', 'notEmptyInvalid' => 'Please enter your password'))), array('regex', true, array('pattern' => '/^.{6,}$/', 'messages' => 'Password must contain at least 6 characters')))));
     // Add real name element
     $this->addElement('text', 'realname', array('label' => 'First name + last name', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter your first name + last name', 'notEmptyInvalid' => 'Please enter your first name + last name'))), array('regex', true, array('pattern' => '/^[a-z\\-\\ \']{2,}$/i', 'messages' => 'Name must contain at least two alphabetic characters and only basic punctuation (hyphen, space and single quote)')))));
     // Add security question element
     $this->addElement('select', 'question', array('label' => 'Security question', 'required' => false, 'multiOptions' => $securityQuestions, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select a security question', 'notEmptyInvalid' => 'Please select a security question'))))));
     // Add security answer element
     $this->addElement('text', 'answer', array('label' => 'Security answer', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter your security answer', 'notEmptyInvalid' => 'Please enter your security answer'))), array('regex', true, array('pattern' => '/^[\\w\\ \\.\\-\'\\,]{2,}$/i', 'messages' => 'Security answer must contain at least two characters and only basic punctuation (hyphen, apostrophe, comma, full stop and space)')))));
     // Add e-mail element
     $this->addElement('text', 'email', array('label' => 'E-mail address', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter your e-mail address'))))));
     $emailValidator = new Zend_Validate_EmailAddress();
     $emailValidator->setMessages(array(Zend_Validate_EmailAddress::INVALID_HOSTNAME => 'Domain name invalid in e-mail address', Zend_Validate_EmailAddress::INVALID_FORMAT => 'Invalid e-mail address'));
     $this->getElement('email')->addValidator($emailValidator);
     $this->setElementFilters(array('StripTags'));
     // Set up the element decorators
     $this->setElementDecorators(array('ViewHelper', 'Label', 'Errors', array('HtmlTag', array('tag' => 'div'))));
     // Add login button
     $this->addElement('submit', 'login', array('label' => 'Login'));
 }
开发者ID:AlexEvesDeveloper,项目名称:hl-stuff,代码行数:36,代码来源:LostLogin.php

示例4: init

 /**
  * Create property subform
  *
  * @return void
  */
 public function init()
 {
     // Add title element
     $this->addElement('select', 'title', array('label' => 'Title', 'required' => true, 'multiOptions' => array('Mr' => 'Mr', 'Mrs' => 'Mrs', 'Ms' => 'Ms', 'Miss' => 'Miss', 'Sir' => 'Sir', 'Mr and Mrs' => 'Mr and Mrs', 'Doctor' => 'Dr', 'Professor' => 'Professor', 'Reverend' => 'Rev', 'Other' => 'Other'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select your title', 'notEmptyInvalid' => 'Please select landlord title'))))));
     // Add first name element
     $this->addElement('text', 'first_name', array('label' => 'First name', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter your first name', 'notEmptyInvalid' => 'Please enter landlord 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)')))));
     // Add last name element
     $this->addElement('text', 'last_name', array('label' => 'Last name', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter landlord 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)')))));
     // Add e-mail element
     $this->addElement('text', 'email_address', array('label' => 'Email address', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter landlord email address'))))));
     $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_address')->addValidator($emailValidator);
     // Add confirm e-mail element
     $this->addElement('text', 'confirm_email_address', array('label' => 'Confirm email address', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please confirm landlord email address'))))));
     // Add phone number element
     $this->addElement('text', 'phone_number', array('label' => 'Phone number', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter landlord phone number'))))));
     // Add Question-1 element
     $this->addElement('radio', 'question1', array('label' => 'Are you aware of any circumstances which may give rise to a claim?', 'required' => true, 'multiOptions' => array('yes' => 'Yes', 'no' => 'No'), 'separator' => ' ', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select answer to question: Are you aware of any circumstances which may give rise to a claim?', 'notEmptyInvalid' => 'Please select answer to question: Are you aware of any circumstances which may give rise to a claim?'))))));
     // Additional claim information element - textarea box
     $this->addElement('textarea', 'claiminfo', array('label' => 'Additional information', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please provide additional claim information.', 'notEmptyInvalid' => 'Please enter additional claim information'))))));
     // Add Question-2 element
     $this->addElement('radio', 'question2', array('label' => 'Will only permitted occupiers be living in the property?', 'required' => true, 'multiOptions' => array('yes' => 'Yes', 'no' => 'No'), 'separator' => ' ', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select answer to question: Will only permitted occupiers be living in the property?', 'notEmptyInvalid' => 'Please select answer to question: Will only permitted occupiers be living in the property?'))))));
     // Add Question-3 element
     $this->addElement('radio', 'question3', array('label' => 'Any tenancy disputes, including late payment of rent?', 'required' => true, 'multiOptions' => array('yes' => 'Yes', 'no' => 'No'), 'separator' => ' ', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select answer to question: Any tenancy disputes, including late payment of rent?', 'notEmptyInvalid' => 'Please select answer to question: Any tenancy disputes, including late payment of rent?'))))));
     // Add agreement element
     $this->addElement('radio', 'agreement', array('label' => 'Type of tenancy agreement', 'required' => true, 'multiOptions' => array('AST' => 'AST', 'Company' => 'Company'), 'separator' => ' ', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select answer to Type of tenancy agreement', 'notEmptyInvalid' => 'Please select answer to Type of tenancy agreement'))))));
     // Set custom subform decorator
     $this->setDecorators(array(array('ViewScript', array('viewScript' => 'rentguarantee/subforms/rent-recovery-plus-application-landlord.phtml'))));
     $this->setElementFilters(array('StripTags'));
     $this->setElementDecorators(array(array('ViewHelper', array('escape' => false)), array('Label', array('escape' => false))));
 }
开发者ID:AlexEvesDeveloper,项目名称:hl-stuff,代码行数:37,代码来源:Landlord.php

示例5: init

 public function init()
 {
     $this->setMethod('post');
     // Email entry
     $this->addElement('text', 'email', array('label' => 'Email address', 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter your email address')))), 'attribs' => array('data-ctfilter' => 'yes')));
     // 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);
     // Password entry
     $this->addElement('password', 'password', array('required' => true, 'label' => 'Password', 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter your password')))), 'attribs' => array('data-ctfilter' => 'yes')));
     // Set up the element decorators
     $this->setElementDecorators(array('ViewHelper', 'Label', 'Errors', array('HtmlTag', array('tag' => 'div'))));
     // Add the submit button
     $this->addElement('submit', 'submit', array('ignore' => true, 'label' => 'Login', 'class' => 'button noalt'));
     // Add a forgotten password button
     $this->addElement('submit', 'forgottenPassword', array('ignore' => true, 'label' => 'Resend Password', 'class' => 'button noalt'));
     // Remove the label from the submit button
     $element = $this->getElement('submit');
     $element->removeDecorator('label');
     $element = $this->getElement('forgottenPassword');
     $element->removeDecorator('label');
     // 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');
 }
开发者ID:AlexEvesDeveloper,项目名称:hl-stuff,代码行数:25,代码来源:Login.php

示例6: init

 /**
  * Create user details form (single user).
  *
  * @return void
  */
 public function init()
 {
     // Invoke the agent user manager
     $agentUserManager = new Manager_Core_Agent_User();
     // Create array of possible security questions
     $securityQuestions = array('' => '--- please select ---');
     $securityQuestions += $agentUserManager->getUserSecurityAllQuestions();
     // Add real name element
     $this->addElement('text', 'realname', array('label' => 'Full name', 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter your full name', 'notEmptyInvalid' => 'Please enter your full name'))), array('regex', true, array('pattern' => '/^[a-z\\-\\ \']{2,}$/i', 'messages' => 'Name must contain at least two alphabetic characters and only basic punctuation (hyphen, space and single quote)')))));
     // Add username element
     $this->addElement('text', 'username', array('label' => 'Username', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter your username', 'notEmptyInvalid' => 'Please enter your username'))), array('regex', true, array('pattern' => '/^[a-z0-9]{1,64}$/i', 'messages' => 'Username must contain between 1 and 64 alphanumeric characters')))));
     if ($this->_role == Model_Core_Agent_UserRole::MASTER) {
         $this->getElement('username')->setRequired(true);
     } else {
         $this->getElement('username')->setAttrib('disabled', 'disabled');
     }
     // Add password1 element
     $passwordElement1 = new Zend_Form_Element_Password('password1');
     $passwordElement1->setRequired(false);
     $passwordElement1->setLabel('New password:');
     $passwordElement1->addValidator(new Zend_Validate_PasswordStrength());
     $this->addElement($passwordElement1);
     $validator = new Zend_Validate_Identical();
     $validator->setToken('password2');
     $validator->setMessage('Passwords are not the same', Zend_Validate_Identical::NOT_SAME);
     $passwordElement1->addValidator($validator);
     $passwordElement2 = new Zend_Form_Element_Password('password2');
     $passwordElement2->setRequired(false);
     $passwordElement2->setLabel('New password (again)');
     $this->addElement($passwordElement2);
     // Add e-mail element
     $this->addElement('text', 'email', array('label' => 'E-mail address', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter your e-mail address'))))));
     $emailValidator = new Zend_Validate_EmailAddress();
     $emailValidator->setMessages(array(Zend_Validate_EmailAddress::INVALID_HOSTNAME => 'Domain name invalid in e-mail address', Zend_Validate_EmailAddress::INVALID_FORMAT => 'Invalid e-mail address'));
     $this->getElement('email')->addValidator($emailValidator);
     if ($this->_role == Model_Core_Agent_UserRole::MASTER) {
         $this->getElement('email')->setRequired(true);
     } else {
         $this->getElement('email')->setAttrib('disabled', 'disabled');
     }
     // Add e-mail element
     $this->addElement('text', 'emailcopyto', array('label' => 'Copy e-mail to', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter a copy-to e-mail address'))))));
     $emailCopyToValidator = new Zend_Validate_EmailAddress();
     $emailCopyToValidator->setMessages(array(Zend_Validate_EmailAddress::INVALID_HOSTNAME => 'Domain name invalid in copy-to e-mail address', Zend_Validate_EmailAddress::INVALID_FORMAT => 'Invalid copy-to e-mail address'));
     $this->getElement('emailcopyto')->addValidator($emailCopyToValidator);
     // Add security question element
     $this->addElement('select', 'question', array('label' => 'Security question', 'required' => false, 'multiOptions' => $securityQuestions));
     // Add security answer element
     $this->addElement('text', 'answer', array('label' => 'Security answer', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('regex', true, array('pattern' => '/^[\\w\\ \\.\\-\'\\,]{2,}$/i', 'messages' => 'Security answer must contain at least two characters and only basic punctuation (hyphen, apostrophe, comma, full stop and space)')))));
     // Add master user element
     $this->addElement('checkbox', 'master', array('label' => 'Master user', 'required' => false, 'checkedValue' => '1', 'uncheckedValue' => '0'));
     // Add agent reports element
     $this->addElement('checkbox', 'reports', array('label' => 'Agent reports', 'required' => false, 'checkedValue' => '1', 'uncheckedValue' => '0'));
     // Add status element
     $this->addElement('checkbox', 'status', array('label' => 'Active', 'required' => false, 'checkedValue' => '1', 'uncheckedValue' => '0'));
     // Set custom subform decorator
     $this->setDecorators(array(array('ViewScript', array('viewScript' => 'settings/subforms/useraccount.phtml', 'role' => $this->_role))));
     $this->setElementFilters(array('StripTags'));
     $this->setElementDecorators(array(array('ViewHelper', array('escape' => false)), array('Label', array('escape' => false))));
 }
开发者ID:AlexEvesDeveloper,项目名称:hl-stuff,代码行数:65,代码来源:UserAccount.php

示例7: testSettingHostnameMessagesThroughEmailValidator

    /**
     * @group ZF-7490
     */
    public function testSettingHostnameMessagesThroughEmailValidator()
    {
        $translations = array(
            'hostnameIpAddressNotAllowed' => 'hostnameIpAddressNotAllowed translation',
            'hostnameUnknownTld' => 'hostnameUnknownTld translation',
            'hostnameDashCharacter' => 'hostnameDashCharacter translation',
            'hostnameInvalidHostnameSchema' => 'hostnameInvalidHostnameSchema translation',
            'hostnameUndecipherableTld' => 'hostnameUndecipherableTld translation',
            'hostnameInvalidHostname' => 'hostnameInvalidHostname translation',
            'hostnameInvalidLocalName' => 'hostnameInvalidLocalName translation',
            'hostnameLocalNameNotAllowed' => 'hostnameLocalNameNotAllowed translation',
        );

        $this->_validator->setMessages($translations);
        $this->_validator->isValid('_XX.!!3xx@0.239,512.777');
        $messages = $this->_validator->getMessages();
        $found = false;
        foreach ($messages as $code => $message) {
            if (array_key_exists($code, $translations)) {
                $this->assertEquals($translations[$code], $message);
                $found = true;
                break;
            }
        }

        $this->assertTrue($found);
    }
开发者ID:htecvc2x,项目名称:htecvc2x-zf-training,代码行数:30,代码来源:EmailAddressTest.php

示例8: init

 /**
  * Create insurance customer search form.
  *
  * @return void
  */
 public function init()
 {
     $this->setMethod('get');
     // Add first name element
     $this->addElement('text', 'firstName', array('label' => 'Customer First Name', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('regex', true, array('pattern' => '/^[a-z\\-\\ \']+$/i', 'messages' => 'Customer First Name must contain alphabetic characters and only basic punctuation (hyphen, space and single quote)')))));
     // Add last name element
     $this->addElement('text', 'lastName', array('label' => 'Customer Last Name', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('regex', true, array('pattern' => '/^[a-z\\-\\ \']+$/i', 'messages' => 'Customer Last Name must contain alphabetic characters and only basic punctuation (hyphen, space and single quote)')))));
     // Add line 1 property address element
     $this->addElement('text', 'address1', array('label' => 'Street Address', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('regex', true, array('pattern' => '/^[a-z0-9\\-\\ \'\\,\\.]+$/i', 'messages' => 'Street Address must contain alphanumeric characters and only basic punctuation (hyphen, space, single quote, comma and full stop)')))));
     // Add line 2 property address element
     $this->addElement('text', 'address2', array('label' => 'Town/City', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('regex', true, array('pattern' => '/^[a-z0-9\\-\\ \'\\,\\.]+$/i', 'messages' => 'Town/City must contain alphanumeric characters and only basic punctuation (hyphen, space, single quote, comma and full stop)')))));
     // Add postcode element
     $this->addElement('text', 'postcode', array('label' => 'Post Code', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('regex', true, array('pattern' => '/^[a-z0-9\\ ]+$/i', 'messages' => 'Post Code must only contain alphanumeric characters and spaces')))));
     // Add telephone element
     $this->addElement('text', 'telephone', array('label' => 'Telephone', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('regex', true, array('pattern' => '/^((\\+44\\s?\\(0\\)\\s?\\d{2,4})|(\\+44\\s?(01|02|03|07|08)\\d{2,3})|(\\+44\\s?(1|2|3|7|8)\\d{2,3})|(\\(\\+44\\)\\s?\\d{3,4})|(\\(\\d{5}\\))|((01|02|03|07|08)\\d{2,3})|(\\d{5}))(\\s|-|.)(((\\d{3,4})(\\s|-)(\\d{3,4}))|((\\d{6,7})))$/', 'messages' => 'Not a valid phone number')))));
     // Add e-mail element
     $this->addElement('text', 'email', array('label' => 'Email', 'required' => false, 'filters' => array('StringTrim')));
     $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);
     // Set up the element decorators
     $this->setElementDecorators(array('ViewHelper', array('HtmlTag', array('tag' => 'div'))));
     // Add search button
     $this->addElement('submit', 'search', array('label' => 'Search'));
 }
开发者ID:AlexEvesDeveloper,项目名称:hl-stuff,代码行数:30,代码来源:InsuranceSearchCustomer.php

示例9: init

 public function init()
 {
     //Reference subject title element
     $this->addElement('select', 'personal_title', array('label' => 'Tenant Title', 'required' => true, 'multiOptions' => array('' => 'Not Known', 'Mr' => 'Mr', 'Ms' => 'Ms', 'Mrs' => 'Mrs', 'Miss' => 'Miss', 'Dr' => 'Dr', 'Prof' => 'Professor', 'Sir' => 'Sir'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select the tenant title', 'notEmptyInvalid' => 'Please select a valid tenant title')))), 'attribs' => array('class' => 'form-control')));
     //First name entry
     $this->addElement('text', 'first_name', array('label' => 'Tenant First Name', 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter the tenant\'s first name')))), 'attribs' => array('data-ctfilter' => 'yes', 'data-required' => 'required', 'data-validate' => 'validate', 'data-type' => 'name', 'class' => 'form-control')));
     //Last name entry
     $this->addElement('text', 'last_name', array('label' => 'Tenant Last Name', 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter the tenant\'s last name')))), 'attribs' => array('data-ctfilter' => 'yes', 'data-required' => 'required', 'data-validate' => 'validate', 'data-type' => 'name', 'class' => 'form-control')));
     // Email entry
     $this->addElement('text', 'email', array('label' => 'Tenant Email Address', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter the tenant\'s email address')))), 'attribs' => array('data-ctfilter' => 'yes', 'class' => 'form-control')));
     $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);
     // Add share of rent element
     $this->addElement('text', 'share_of_rent', array('label' => 'Share of rent per month (£)', 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter the share of rent per month')), 'Digits', true, array('messages' => array('notDigits' => 'Please enter the share of rent per month', 'digitsStringEmpty' => 'Please enter the Share of rent per month')))), 'attribs' => array('data-required' => 'required', 'data-validate' => 'validate', 'data-type' => 'currency', 'class' => 'currency form-control')));
     // List the products based on the user choice.
     $productManager = new Manager_Referencing_Product();
     $session = new Zend_Session_Namespace('referencing_global');
     $productList = array();
     if ($session->displayRentGuaranteeProducts) {
         $productVariable = Model_Referencing_ProductVariables::RENT_GUARANTEE;
         $products = $productManager->getByVariable($productVariable);
         foreach ($products as $product) {
             if (!preg_match("/international/i", $product->name)) {
                 $productList[$product->key] = strtoupper($product->name);
             }
         }
     } else {
         $productVariable = Model_Referencing_ProductVariables::NON_RENT_GUARANTEE;
         $products = $productManager->getByVariable($productVariable);
         $productSelection = new Model_Referencing_ProductSelection();
         $productSelection->referenceId = 0;
         $productSelection->duration = 0;
         foreach ($products as $product) {
             if (!preg_match("/international/i", $product->name)) {
                 $productSelection->product = $product;
                 $price = $productManager->getPrice($productSelection);
                 $productList[$product->key] = strtoupper($product->name) . " (" . $price . " + VAT)";
             }
         }
     }
     $this->addElement('radio', 'product_choice', array('required' => true, 'multiOptions' => $productList, 'separator' => '', 'label_placement' => 'prepend', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select your product choice', 'notEmptyInvalid' => 'Please select a valid product choice'))))));
     //Identify if we need to indicate duration.
     if ($session->displayRentGuaranteeProducts) {
         //Determine the allowable durations... Needs to be done in ajax
         //Display duration box.
         $this->addElement('select', 'product_duration', array('label' => 'Product Duration (months)', 'required' => true, 'multiOptions' => array(6 => '6', 12 => '12'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select the product duration', 'notEmptyInvalid' => 'Please select a valid product duration')))), 'attribs' => array('class' => 'form-control')));
     }
     //Completion method element
     $this->addElement('select', 'completion_method', array('label' => 'Completion Method', 'required' => true, 'multiOptions' => array(Model_Referencing_ReferenceCompletionMethods::ONE_STEP => 'Complete Information Now', Model_Referencing_ReferenceCompletionMethods::TWO_STEP => 'Email to Tenant'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select the completion method', 'notEmptyInvalid' => 'Please select a valid completion method')))), 'attribs' => array('class' => 'form-control')));
     // Set custom subform decorator
     $this->setDecorators(array(array('ViewScript', array('viewScript' => 'landlords-referencing/product-selection.phtml'))));
     // Strip all tags to prevent XSS errors
     $this->setElementFilters(array('StripTags'));
     $this->setElementDecorators(array(array('ViewHelper', array('escape' => false)), array('Label', array('escape' => false))));
 }
开发者ID:AlexEvesDeveloper,项目名称:hl-stuff,代码行数:56,代码来源:ProductSelection.php

示例10: init

 /**
  * (non-PHPdoc)
  * @see library/Zend/Form/Zend_Form_Element#init()
  */
 public function init()
 {
     parent::init();
     /**
      * @todo Change this wired error messages to something more user friendly, or even use simple email regex matching validator
      */
     $validatorHostname = new Zend_Validate_Hostname();
     $validatorHostname->setMessages(array(Zend_Validate_Hostname::IP_ADDRESS_NOT_ALLOWED => "'%value%' appears to be an IP address, but IP addresses are not allowed", Zend_Validate_Hostname::UNKNOWN_TLD => "'%value%' appears to be a DNS hostname but cannot match TLD against known list", Zend_Validate_Hostname::INVALID_DASH => "'%value%' appears to be a DNS hostname but contains a dash (-) in an invalid position", Zend_Validate_Hostname::INVALID_HOSTNAME_SCHEMA => "'%value%' appears to be a DNS hostname but cannot match against hostname schema for TLD '%tld%'", Zend_Validate_Hostname::UNDECIPHERABLE_TLD => "'%value%' appears to be a DNS hostname but cannot extract TLD part", Zend_Validate_Hostname::INVALID_HOSTNAME => "'%value%' does not match the expected structure for a DNS hostname", Zend_Validate_Hostname::INVALID_LOCAL_NAME => "'%value%' does not appear to be a valid local network name", Zend_Validate_Hostname::LOCAL_NAME_NOT_ALLOWED => "'%value%' appears to be a local network name but local network names are not allowed"));
     $validatorEmail = new Zend_Validate_EmailAddress(Zend_Validate_Hostname::ALLOW_DNS, false, $validatorHostname);
     $validatorEmail->setMessages(array(Zend_Validate_EmailAddress::INVALID => "'%value%' is not a valid email address", Zend_Validate_EmailAddress::INVALID_HOSTNAME => "'%hostname%' is not a valid hostname for email address '%value%'", Zend_Validate_EmailAddress::INVALID_MX_RECORD => "'%hostname%' does not appear to have a valid MX record for the email address '%value%'", Zend_Validate_EmailAddress::DOT_ATOM => "'%localPart%' not matched against dot-atom format", Zend_Validate_EmailAddress::QUOTED_STRING => "'%localPart%' not matched against quoted-string format", Zend_Validate_EmailAddress::INVALID_LOCAL_PART => "'%localPart%' is not a valid local part for email address '%value%'"));
     $this->addValidator($validatorEmail);
 }
开发者ID:xinghao,项目名称:shs,代码行数:16,代码来源:Email.php

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

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

示例13: init

 /**
  * Create reference resend e-mail to applicant form.
  *
  * @return void
  */
 public function init()
 {
     // Add e-mail element
     $this->addElement('text', 'email', array('label' => 'E-mail address', 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter recipient\'s e-mail address'))))));
     $emailValidator = new Zend_Validate_EmailAddress();
     $emailValidator->setMessages(array(Zend_Validate_EmailAddress::INVALID_HOSTNAME => 'Domain name invalid in e-mail address', Zend_Validate_EmailAddress::INVALID_FORMAT => 'Invalid e-mail address'));
     $this->getElement('email')->addValidator($emailValidator);
     // Add replace e-mail address element
     $this->addElement('checkbox', 'replace', array('label' => 'Replace e-mail address', 'checkedValue' => '1'));
     // Set up the element decorators
     $this->setElementDecorators(array('ViewHelper', array('HtmlTag', array('tag' => 'div'))));
     // Add send button
     $this->addElement('submit', 'send', array('label' => 'Send'));
 }
开发者ID:AlexEvesDeveloper,项目名称:hl-stuff,代码行数:19,代码来源:ReferencingResendEmail.php

示例14: init

 public function init()
 {
     //Reference subject title element
     $this->addElement('select', 'personal_title', array('label' => 'Title', 'required' => true, 'multiOptions' => array('' => 'Not Known', 'Mr' => 'Mr', 'Ms' => 'Ms', 'Mrs' => 'Mrs', 'Miss' => 'Miss', 'Dr' => 'Dr', 'Prof' => 'Professor', 'Sir' => 'Sir'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select the title', 'notEmptyInvalid' => 'Please select a valid title')))), 'attribs' => array('class' => 'form-control')));
     //First name entry
     $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 a first name')))), 'attribs' => array('data-ctfilter' => 'yes', 'data-required' => 'required', 'data-validate' => 'validate', 'data-type' => 'name', 'class' => 'form-control')));
     //Middle name entry
     $this->addElement('text', 'middle_name', array('label' => 'Middle name', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter a middle name')))), 'attribs' => array('data-ctfilter' => 'yes', 'class' => 'form-control')));
     //Last name entry
     $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 a last name')))), 'attribs' => array('data-ctfilter' => 'yes', 'data-required' => 'required', 'data-validate' => 'validate', 'data-type' => 'name', 'class' => 'form-control')));
     //Other name entry
     $this->addElement('text', 'other_name', array('label' => 'Other name which known by', 'required' => false, 'filters' => array('StringTrim'), 'attribs' => array('data-ctfilter' => 'yes', 'class' => 'form-control')));
     //Phone number entry
     $this->addElement('text', 'telephone_day', array('label' => 'Daytime telephone number', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter a daytime phone number'))), array('regex', true, array('pattern' => '/^((\\+44\\s?\\(0\\)\\s?\\d{2,4})|(\\+44\\s?(01|02|03|07|08)\\d{2,3})|(\\+44\\s?(1|2|3|7|8)\\d{2,3})|(\\(\\+44\\)\\s?\\d{3,4})|(\\(\\d{5}\\))|((01|02|03|07|08)\\d{2,3})|(\\d{5}))(\\s|-|.)(((\\d{3,4})(\\s|-)(\\d{3,4}))|((\\d{6,7})))$/', 'messages' => 'Not a valid phone number'))), 'attribs' => array('data-ctfilter' => 'yes', 'data-required' => 'required', 'data-validate' => 'validate', 'data-type' => 'phone', 'class' => 'form-control')));
     //Evening phone number
     $this->addElement('text', 'mobile_number', array('label' => 'Mobile number', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter a mobile phone number'))), array('regex', true, array('pattern' => '/^((\\+44\\s?\\(0\\)\\s?\\d{2,4})|(\\+44\\s?(01|02|03|07|08)\\d{2,3})|(\\+44\\s?(1|2|3|7|8)\\d{2,3})|(\\(\\+44\\)\\s?\\d{3,4})|(\\(\\d{5}\\))|((01|02|03|07|08)\\d{2,3})|(\\d{5}))(\\s|-|.)(((\\d{3,4})(\\s|-)(\\d{3,4}))|((\\d{6,7})))$/', 'messages' => 'Not a valid phone number'))), 'attribs' => array('data-ctfilter' => 'yes', 'class' => 'form-control')));
     // Email entry
     $this->addElement('text', 'email', array('label' => 'Email address', 'required' => false, 'filters' => array('StringTrim'), 'attribs' => array('data-ctfilter' => 'yes', 'class' => 'form-control')));
     $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);
     //Date of birth. Use the 'tenancy start date' dropdowns for now, then re-purpose later.
     $this->addElement('text', 'tenancy_start_date', array('label' => 'Date of birth', 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter a date of birth'))))));
     //Grab view and add the date picker JavaScript files into the page head
     $view = Zend_Controller_Front::getInstance()->getParam('bootstrap')->getResource('view');
     $view->headLink()->appendStylesheet('/assets/vendor/bootstrap-datepicker/css/bootstrap-datepicker.min.css', 'screen');
     $view->headScript()->appendFile('/assets/vendor/jquery-date/js/date.js', 'text/javascript')->appendFile('/assets/vendor/bootstrap-datepicker/js/bootstrap-datepicker.min.js', 'text/javascript')->appendFile('/assets/landlords-referencing/js/referencingBirthDatePicker.js', 'text/javascript');
     // Add bank account number element
     $this->addElement('text', 'bank_account_number', array('label' => 'Bank account number', 'required' => false, 'attribs' => array('class' => 'form-control')));
     // Add bank sort code element
     $this->addElement('text', 'bank_sortcode_number', array('label' => 'Bank sort code', 'required' => false, 'attribs' => array('class' => 'form-control')));
     //Residential status element
     $this->addElement('select', 'residential_status', array('label' => 'Current residential status', 'required' => true, 'multiOptions' => array('' => 'Please Select', Model_Referencing_ResidenceStatus::OWNER => 'Home Owner', Model_Referencing_ResidenceStatus::TENANT => 'Tenant', Model_Referencing_ResidenceStatus::LIVING_WITH_RELATIVES => 'Living with Relatives'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select the residential status', 'notEmptyInvalid' => 'Please select a valid residential status')))), 'attribs' => array('class' => 'form-control')));
     //Occupational status element
     $this->addElement('select', 'occupational_type', array('label' => 'Current occupation status', 'required' => true, 'multiOptions' => array('' => 'Please Select', Model_Referencing_OccupationTypes::EMPLOYMENT => 'Permanently Employed', Model_Referencing_OccupationTypes::CONTRACT => 'On Contract', Model_Referencing_OccupationTypes::SELFEMPLOYMENT => 'Self Employed', Model_Referencing_OccupationTypes::RETIREMENT => 'Pensioner', Model_Referencing_OccupationTypes::STUDENT => 'Student', Model_Referencing_OccupationTypes::UNEMPLOYMENT => 'Unemployed', Model_Referencing_OccupationTypes::INDEPENDENT => 'Of Independant Means'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select the occupational status', 'notEmptyInvalid' => 'Please select a valid occupational status')))), 'attribs' => array('class' => 'form-control')));
     //Drop down displayed only when applicant is Unemployed or a Student.
     $this->addElement('select', 'is_future_employment_secured', array('label' => 'Will the applicant start a new employed position during the tenancy term?', 'required' => false, 'multiOptions' => array('' => 'Please Select', 'Yes' => 'Yes', 'No' => 'No'), 'attribs' => array('class' => 'form-control')));
     //Add total gross annual income
     $this->addElement('text', 'total_annual_income', array('label' => 'Total gross annual income (£)', 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter the total gross annual income'))), array('Digits', true, array('messages' => array('notDigits' => 'Total gross annual income can only contain digits', 'digitsStringEmpty' => 'Total gross annual income can only contain digits')))), 'attribs' => array('data-required' => 'required', 'data-validate' => 'validate', 'data-type' => 'currency', 'class' => 'currency form-control')));
     //Occupation will change element
     $this->addElement('select', 'occupation_will_change', array('label' => 'Is occupation about to change?', 'required' => true, 'multiOptions' => array('' => 'Please Select', 'Yes' => 'Yes', 'No' => 'No'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select if this occupation is about to change', 'notEmptyInvalid' => 'Please select if this occupation is about to change')))), 'attribs' => array('class' => 'form-control')));
     //Has adverse credit history
     $this->addElement('select', 'has_adverse_credit', array('label' => 'Does the applicant have CCJs or adverse credit history?', 'required' => true, 'multiOptions' => array('' => 'Please Select', 'Yes' => 'Yes', 'No' => 'No'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select if there is adverse credit history', 'notEmptyInvalid' => 'Please select if there is adverse credit history')))), 'attribs' => array('class' => 'form-control')));
     // Set custom subform decorator
     $this->setDecorators(array(array('ViewScript', array('viewScript' => 'landlords-referencing/reference-subject.phtml'))));
     // Strip all tags to prevent XSS errors
     $this->setElementFilters(array('StripTags'));
     $this->setElementDecorators(array(array('ViewHelper', array('escape' => false)), array('Label', array('escape' => false))));
 }
开发者ID:AlexEvesDeveloper,项目名称:hl-stuff,代码行数:49,代码来源:ReferenceSubject.php

示例15: init

 /**
  * Create e-mail addresses form.
  *
  * @return void
  */
 public function init()
 {
     $emailValidator = new Zend_Validate_EmailAddress();
     $emailValidator->setMessages(array(Zend_Validate_EmailAddress::INVALID_HOSTNAME => 'Domain name invalid in e-mail address', Zend_Validate_EmailAddress::INVALID_FORMAT => 'Invalid e-mail address'));
     // Add an e-mail element for each e-mail category
     foreach (Model_Core_Agent_EmailMapCategory::iterableKeys() as $categoryConstName => $val) {
         $categoryFriendlyName = Model_Core_Agent_EmailMapCategory::toString($val);
         // Add e-mail element
         $this->addElement('text', "email{$categoryConstName}", array('label' => $categoryFriendlyName, 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => "Please enter your {$categoryFriendlyName} e-mail address"))))));
         $this->getElement("email{$categoryConstName}")->addValidator($emailValidator);
     }
     // Set custom subform decorator
     $this->setDecorators(array(array('ViewScript', array('viewScript' => 'settings/subforms/emailaddresses.phtml'))));
     $this->setElementFilters(array('StripTags'));
     $this->setElementDecorators(array(array('ViewHelper', array('escape' => false)), array('Label', array('escape' => false))));
 }
开发者ID:AlexEvesDeveloper,项目名称:hl-stuff,代码行数:21,代码来源:EmailAddresses.php


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