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


PHP Zend_Form_Element_Password::addValidator方法代码示例

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


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

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

示例2: init

 /**
  * Creates the form to log in.
  * @see Zend_Form::init()
  */
 public function init()
 {
     $this->setMethod('post');
     $this->setAction("/auth/login/");
     $usernameElement = new Zend_Form_Element_Text('username');
     $usernameElement->setLabel("Benutzername");
     $usernameElement->addValidator('regex', false, array('/^[a-z0-9]/i'));
     $usernameElement->addValidator('stringLength', false, array(2, 64));
     $usernameElement->setAttrib('maxLength', 64);
     $usernameElement->setRequired(true);
     $passwordElement = new Zend_Form_Element_Password('password');
     $passwordElement->setLabel("Passwort");
     $passwordElement->addValidator('regex', false, array('/^[a-z0-9]/i'));
     $passwordElement->addValidator('stringLength', false, array(8, 32));
     $passwordElement->setAttrib('maxLength', 32);
     $passwordElement->setRequired(true);
     $submitElement = new Zend_Form_Element_Submit('submit');
     $submitElement->setLabel('Anmelden');
     $submitElement->setIgnore(true);
     $submitElement->setAttrib('class', 'submit');
     $submitElement->removeDecorator('DtDdWrapper');
     $this->addElements(array($usernameElement, $passwordElement));
     $this->addDisplayGroup(array('username', 'password'), 'credentialGroup', array('legend' => 'Zugangsdaten'));
     $this->addElements(array($submitElement));
 }
开发者ID:rusli-nasir,项目名称:iHealth,代码行数:29,代码来源:Login.php

示例3: editUserPassword

 function editUserPassword()
 {
     $this->setMethod('post');
     $this->addAttribs(array('id' => 'formAccountEditPassword', 'class' => ''));
     $filters = array(new Zend_Filter_StringTrim(), new Zend_Filter_StripTags());
     $control = new Zend_Form_Element_Hidden('control');
     $control->setValue('editPassword');
     $this->addElement($control);
     $oldPassword = new Zend_Form_Element_Password('oldPassword');
     $oldPassword->setLabel('Old password');
     $oldPassword->addValidator(new Zend_Validate_StringLength(6, 32));
     $oldPassword->setAttribs(array('class' => 'text validate[required,minSize[6],maxSize[32]] rightAdd', 'minlenght' => '6', 'maxlenght' => '32', 'autocomplete' => 'off', 'oncontextmenu' => 'return false', 'data-prompt-position' => 'topLeft:0'));
     $oldPassword->setRequired(true);
     $this->addElement($oldPassword);
     $password = new Zend_Form_Element_Password('password');
     $password->setLabel(Zend_Registry::get('translate')->_('admin_administrators_new_password'));
     $password->addValidator(new Zend_Validate_StringLength(6, 32));
     $password->setAttribs(array('class' => 'text validate[required] rightAdd', 'maxlenght' => '32', 'autocomplete' => 'off', 'oncontextmenu' => 'return false', 'ondrop' => 'return false', 'onpaste' => 'return false'));
     $password->setRequired(true);
     $this->addElement($password);
     $retypePassword = new Zend_Form_Element_Password('retypePassword');
     $retypePassword->setLabel(Zend_Registry::get('translate')->_('admin_administrators_retype_new_password'));
     $retypePassword->addValidator(new Zend_Validate_Identical('password'));
     $retypePassword->addValidator(new Zend_Validate_StringLength(6, 32));
     $retypePassword->setAttribs(array('class' => 'text validate[required] rightAdd', 'maxlenght' => '32', 'autocomplete' => 'off', 'oncontextmenu' => 'return false', 'ondrop' => 'return false', 'onpaste' => 'return false'));
     $retypePassword->setRequired(true);
     $retypePassword->setIgnore(true);
     $this->addElement($retypePassword);
     $submit = new Zend_Form_Element_Submit('savePassword');
     $submit->setValue(Zend_Registry::get('translate')->_('apply_password'));
     $submit->setAttribs(array('class' => 'submit tsSubmitLogin fL'));
     $submit->setIgnore(true);
     $this->addElement($submit);
     $this->setElementFilters($filters);
 }
开发者ID:valizr,项目名称:MMA,代码行数:35,代码来源:EditPassword.php

示例4: init

 public function init()
 {
     // Set the method for the display form to POST
     $this->setMethod('post');
     $this->setAttribs(array('class' => 'form-horizontal'));
     $decoratorField = new My_Decorator_FieldLogin();
     $elements = array();
     // Add oldpass field
     $input = new Zend_Form_Element_Password('oldpassword', array('required' => true, 'label' => 'Old Password:', 'id' => 'oldpassword', 'placeholder' => 'Old pass..', 'class' => 'form-control'));
     $input->addValidator(new Zend_Validate_NotEmpty());
     $input->addDecorator($decoratorField);
     $elements[] = $input;
     // Add newpass1 field
     $input = new Zend_Form_Element_Password('newpassword1', array('required' => true, 'label' => 'New Password:', 'id' => 'newpassword1', 'class' => 'form-control', 'placeholder' => 'Your password..'));
     $input->addValidators(array(new Zend_Validate_Alnum(), new Zend_Validate_StringLength(array('min' => 8)), new Zend_Validate_NotEmpty()));
     $input->addDecorator($decoratorField);
     $elements[] = $input;
     // Add newpass2 field
     $input = new Zend_Form_Element_Password('newpassword2', array('required' => true, 'label' => 'New Password Again:', 'id' => 'newpassword2', 'class' => 'form-control', 'placeholder' => 'Your password again..', 'validators' => array(array('identical', false, array('token' => 'newpassword1')))));
     $input->addDecorator($decoratorField);
     $elements[] = $input;
     //Add Submit button
     $input = new Zend_Form_Element_Submit('submit', array('Label' => '', 'class' => 'btn btn-default', 'value' => 'Update'));
     $input->addDecorator($decoratorField);
     $elements[] = $input;
     $this->addElements($elements);
     $this->addDisplayGroup(array('oldpassword', 'newpassword1', 'newpassword2', 'submit'), 'displgrp', array('decorators' => array('FormElements')));
 }
开发者ID:cioionut,项目名称:products-webEcommerce,代码行数:28,代码来源:ChPass.php

示例5: init

 public function init()
 {
     global $mySession;
     $db = new Db();
     # FORM ELEMENT:Public Name
     # TYPE : text
     $publicname = new Zend_Form_Element_Text('publicname');
     $publicname->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Public name is required'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib('class', 'logintextbox');
     # FORM ELEMENT:Email ID
     # TYPE : text
     $signupemailid = new Zend_Form_Element_Text('signupemailid');
     $signupemailid->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Email Id is required'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib('class', 'logintextbox');
     //->setAttrib("onchange","validval(this.value);")
     //->setAttrib("onclick","changeborder(this.id);")
     if (@$_REQUEST['signupemailid'] != "") {
         $signupemailid->addValidator('EmailAddress', true)->addDecorator('Errors', array('class' => 'errmsg'))->addErrorMessage('Please enter a valid email address');
     }
     # FORM ELEMENT:password
     # TYPE : text
     $signuppass = new Zend_Form_Element_Password('signuppass');
     $signuppass->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Password is required'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib('class', 'logintextbox');
     if (@$_REQUEST['signuppass'] != "") {
         $signuppass->addValidator('StringLength', 0, 6, true)->addErrorMessage('Password must be atleast 6 characters');
     }
     # FORM ELEMENT: confirm password
     # TYPE : text
     $signupcnfrmpass = new Zend_Form_Element_Password('signupcnfrmpass');
     $signupcnfrmpass->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Confirm Password is required'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib('class', 'logintextbox');
     if (@$_REQUEST['signupcnfrmpass'] != "") {
         $signupcnfrmpass->addValidator('StringLength', 0, 6, true)->addErrorMessage('Password must be atleast 6 characters');
     }
     $this->addElements(array($publicname, $signupemailid, $signuppass, $signupcnfrmpass));
 }
开发者ID:Alexeykolobov,项目名称:php,代码行数:33,代码来源:Signup.php

示例6: init

    public function init()
    {
        $tr = Zend_Registry::get('tr');
        
        $handle = new Zend_Form_Element_Text('handle');
        $handle->setLabel($tr->_('HANDLE'));
        $handle->setRequired(true);
        $handle->addValidator('NotEmpty', true, array('messages' => $tr->_('GENERAL_MISSING_TEXT_VALUE')));
        $this->addElement($handle);

        $password = new Zend_Form_Element_Password('password');
        $password->setLabel($tr->_('PASSWORD'));
        $password->setRequired(true);
        $password->addValidator('NotEmpty', true, array('messages' => $tr->_('GENERAL_MISSING_TEXT_VALUE')));
        $this->addElement($password);

        $password1 = new Zend_Form_Element_Password('password_again');
        $password1->setLabel($tr->_('RETYPE') . ' ' . $tr->_('PASSWORD'));
        $password1->setRequired(true);
        $password1->addValidator('NotEmpty', true, array('messages' => $tr->_('GENERAL_MISSING_TEXT_VALUE')));
        $this->addElement($password1);

        $this->addElement(new Zend_Form_Element_Submit($tr->_('SUBMIT')));

        parent::init();
    }
开发者ID:reith2004,项目名称:frapi,代码行数:26,代码来源:User.php

示例7: init

 public function init()
 {
     $firstnameField = new Zend_Form_Element_Text('firstname');
     $firstnameField->addValidator(new Zend_Validate_Alnum());
     $firstnameField->setRequired(true);
     $lastnameField = new Zend_Form_Element_Text('lastname');
     $lastnameField->addValidator(new Zend_Validate_Alnum());
     $lastnameField->setRequired(true);
     $emailField = new Zend_Form_Element_Text('email');
     $emailField->addValidator(new Zend_Validate_EmailAddress());
     $emailField->setRequired(true);
     $loginField = new Zend_Form_Element_Text('login');
     $loginField->addValidator(new Zend_Validate_Alnum());
     $loginField->setRequired(true);
     $teamMapper = new User_Model_Mapper_Team();
     $teamArray = $teamMapper->getList();
     foreach ($teamArray as $rowTeam) {
         $teams[$rowTeam->getId()] = $rowTeam->getName();
     }
     $teamField = new Zend_Form_Element_Select('team');
     $teamField->addMultiOptions($teams);
     $idField = new Zend_Form_Element_Hidden('id');
     $passwordField = new Zend_Form_Element_Password('password');
     $passwordField->addValidator(new Zend_Validate_StringLength(array('min' => 6, 'max' => 18)));
     $submitBtn = new Zend_Form_Element_Submit('submit');
     $this->addElements(array($firstnameField, $lastnameField, $emailField, $loginField, $passwordField, $teamField, $idField, $submitBtn));
     $this->setAction('');
 }
开发者ID:rcomone,项目名称:bugtrack,代码行数:28,代码来源:Save.php

示例8: createDBForm

 /** create  form */
 public function createDBForm()
 {
     $form = new Zend_Form();
     $form->setAction($this->webroot . '/install/step2')->setMethod('post');
     $type = new Zend_Form_Element_Hidden('type');
     $host = new Zend_Form_Element_Text('host');
     $host->setValue('localhost');
     $port = new Zend_Form_Element_Text('port');
     $port->addValidator('Digits', true);
     $unixsocket = new Zend_Form_Element_Text('unix_socket');
     $dbname = new Zend_Form_Element_Text('dbname');
     $dbname->setRequired(true)->addValidator('NotEmpty', true)->setValue('midas');
     $username = new Zend_Form_Element_Text('username');
     $username->setRequired(true)->addValidator('NotEmpty', true);
     $password = new Zend_Form_Element_Password('password');
     $firstname = new Zend_Form_Element_Text('firstname');
     $firstname->setRequired(true)->addValidator('NotEmpty', true);
     $lastname = new Zend_Form_Element_Text('lastname');
     $lastname->setRequired(true)->addValidator('NotEmpty', true);
     $email = new Zend_Form_Element_Text('email');
     $email->setRequired(true)->addValidator('NotEmpty', true)->addValidator('EmailAddress');
     $userpassword1 = new Zend_Form_Element_Password('userpassword1');
     $userpassword1->addValidator('NotEmpty', true)->setRequired(true);
     $userpassword2 = new Zend_Form_Element_Password('userpassword2');
     $userpassword2->addValidator('NotEmpty', true)->setRequired(true);
     $gravatar = new Zend_Form_Element_Checkbox('gravatar');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel('Setup database and account');
     $form->addElements(array($type, $host, $port, $unixsocket, $dbname, $username, $password, $firstname, $lastname, $email, $userpassword1, $userpassword2, $gravatar, $submit));
     return $form;
 }
开发者ID:josephsnyder,项目名称:Midas,代码行数:32,代码来源:InstallForm.php

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

示例10: init

 public function init()
 {
     $this->setAttrib('class', 'form-horizontal');
     $login = new Zend_Form_Element_Text('login');
     $login->setRequired()->addValidator('StringLength', false, array('max' => 32))->setLabel('Nom d\'utilisateur');
     $db = Zend_Db_Table::getDefaultAdapter();
     $validator = new Zend_Validate_Db_NoRecordExists(array('adapter' => $db, 'schema' => 'twitter', 'table' => 'membre', 'field' => 'login'));
     $validator->setMessage("Le login '%value%' est déjà utilisé");
     $login->addValidator($validator);
     $pass = new Zend_Form_Element_Password('pass');
     $pass->setLabel('Mot de passe')->setRequired();
     $passConfirm = new Zend_Form_Element_Password('confirm');
     $passConfirm->setLabel('Confirmer le mot de passe');
     $validator = new Zend_Validate_Identical('pass');
     $validator->setMessage('La confirmation ne correspond pas au mot de passe');
     $passConfirm->addValidator($validator);
     //$passConfirm->addValidator('Identical', false, array('token'));
     $hash = new Zend_Form_Element_Hash('hash');
     $submit = new Zend_Form_Element_Submit('Inscription');
     $cancel = new Zend_Form_Element_Button('Annuler');
     $this->addElements(array($login, $pass, $passConfirm, $hash, $submit, $cancel));
     // add display group
     $this->addDisplayGroup(array('login', 'pass', 'confirm', 'Inscription', 'Annuler'), 'users');
     $this->getDisplayGroup('users')->setLegend('S\'inscrire');
     // set decorators
     EasyBib_Form_Decorator::setFormDecorator($this, EasyBib_Form_Decorator::BOOTSTRAP, 'Inscription', 'Annuler');
 }
开发者ID:romainnext,项目名称:ZFTwitter,代码行数:27,代码来源:Membre.php

示例11: init

 public function init()
 {
     $this->setMethod('POST');
     $defaultArgs = array('disableLoadDefaultDecorators' => true, 'decorators' => array('ViewHelper'));
     $identity = $this->getAttrib('user_id');
     $user_object = Engine_Api::_()->user()->getUser($identity);
     $user_id = new Zend_Form_Element_Hidden('user_id');
     $user_id->setValue($identity);
     $email = new Zend_Form_Element_Text('email', $defaultArgs);
     $email->addValidator('emailAddress', true)->addValidator(new Zend_Validate_Db_NoRecordExists(Engine_Db_Table::getTablePrefix() . 'users', 'email'));
     $email->setValue($user_object->email);
     $password = new Zend_Form_Element_Password('password', $defaultArgs);
     $password->addValidator('stringLength', false, array(6, 32));
     $passconf = new User_Form_Element_PasswordConfirm('passconf', $defaultArgs);
     //$passconf->addDecorator('ViewHelper');
     if ($settings->getSetting('user.signup.username', 1) > 0) {
         $username = new Zend_Form_Element_Text('username', $defaultArgs);
         $username->setValue($user_object->username);
         $username->addValidator('stringLength', true, array(6, 32))->addValidator(new Zend_Validate_Db_NoRecordExists(Engine_Db_Table::getTablePrefix() . 'users', 'username'));
     }
     $language = new Zend_Form_Element_Select('language', $defaultArgs);
     $language->addMultiOptions(array('English', 'post-English'));
     $language->setValue($user_object->language_id);
     $level_id = new Zend_Form_Element_Select('level_id', $defaultArgs);
     $level_id->setValue($user_object->level_id);
     $levels = Engine_Api::_()->authorization()->getLevelInfo();
     foreach ($levels as $level) {
         $level_id->addMultiOption($level['level_id'], $level['title']);
     }
     $this->addElements(array($user_id, $email, $password, $passconf, $username, $level_id, $language));
 }
开发者ID:HiLeo1610,项目名称:tumlumsach,代码行数:31,代码来源:Account.php

示例12: init

 public function init()
 {
     $this->setMethod('post')->setAttrib('id', 'frmRegistrar');
     $e = new Zend_Form_Element_Text('nombre');
     $e->setRequired();
     $e->setLabel('Nombre');
     $e->addValidator(new Zend_Validate_StringLength(array('min' => 5, 'max' => 25)));
     $e->addValidator(new My_Validate_NoX());
     $e->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'usuario', 'field' => 'nombre')));
     $this->addElement($e);
     $e = new Zend_Form_Element_Text('login');
     $e->setRequired();
     $e->setLabel('Login');
     $e->addValidator(new Zend_Validate_Alnum());
     $e->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'usuario', 'field' => 'login')));
     $e->addValidator(new Zend_Validate_StringLength(array('min' => 5, 'max' => 25)));
     $this->addElement($e);
     $e = new Zend_Form_Element_Password('pwd');
     $e->setRequired();
     $e->setLabel('Password');
     $this->addElement($e);
     $e = new Zend_Form_Element_Password('pwd_2');
     $e->setRequired();
     $e->setLabel('Confirmación Password');
     $e->addValidator(new My_Validate_PasswordConfirmation());
     $this->addElement($e);
     $this->addElement('submit', 'Enviar');
 }
开发者ID:helmutpacheco,项目名称:ventas,代码行数:28,代码来源:Registrar.php

示例13: getForm

 function getForm()
 {
     $form = new Cible_Form(array('disabledDefaultActions' => true));
     $base_dir = $this->getFrontController()->getBaseUrl();
     $redirect = str_replace($base_dir, '', $this->_request->getParam('redirect'));
     $form->setAction("{$base_dir}/auth/login")->setMethod('post');
     $form->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table')), 'Form'));
     $form->setAttrib('class', 'auth-form');
     $username = new Zend_Form_Element_Text('username');
     $username->setLabel(Cible_Translation::getCibleText('form_label_username'));
     $username->setRequired(true);
     $username->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => Cible_Translation::getCibleText('error_field_required'))));
     $username->setAttrib('class', 'loginTextInput');
     $username->setDecorators(array('ViewHelper', 'Description', 'Errors', 'Label', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class' => 'username')), array(array('row' => 'HtmlTag'), array('tag' => 'tr', 'openOnly' => true))));
     $form->addElement($username);
     $password = new Zend_Form_Element_Password('password');
     $password->setLabel(Cible_Translation::getCibleText('form_label_password'));
     $password->setRequired(true);
     $password->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => Cible_Translation::getCibleText('error_field_required'))));
     $password->setAttrib('class', 'loginTextInput');
     $password->setDecorators(array('ViewHelper', 'Description', 'Errors', 'Label', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class' => 'password')), array(array('row' => 'HtmlTag'), array('tag' => 'tr', 'closeOnly' => true))));
     $form->addElement($password);
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel(Cible_Translation::getCibleText('button_authenticate'))->setAttrib('class', 'loginButton')->setAttrib('onmouseover', 'this.className=\'loginButtonOver\';')->setAttrib('onmouseout', 'this.className=\'loginButton\';')->removeDecorator('label')->setDecorators(array('ViewHelper', 'Description', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'colspan' => '2', 'align' => 'right', 'class' => 'submit')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
     $form->addElement($submit);
     $redirect_hidden = new Zend_Form_Element_Hidden('redirect');
     $redirect_hidden->setValue($redirect)->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'colspan' => '2')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
     $form->addElement($redirect_hidden);
     return $form;
 }
开发者ID:anunay,项目名称:stentors,代码行数:30,代码来源:AuthController.php

示例14: init

 public function init()
 {
     $this->setMethod('post');
     //        $this->setAction('/index/login');
     $this->setAttrib('id', 'msform');
     $email = new Zend_Form_Element_Text('email');
     $email->setAttrib('placeholder', 'E-mail');
     $email->setAttrib('autocomplete', 'off');
     $email->addFilter('StripTags');
     $email->addFilter('HtmlEntities');
     $email->addFilter('StringTrim');
     $email->setRequired(true)->addErrorMessage('Username Required');
     $email->addValidator('EmailAddress')->addErrorMessage('Invalid Email used');
     $email->addValidator('StringLength', true, array(0, 255))->addErrorMessage('Required Field');
     $password = new Zend_Form_Element_Password('password');
     $password->setAttrib('placeholder', 'Password');
     $password->setAttrib('autocomplete', 'off');
     $password->addFilter('StripTags');
     $password->addFilter('HtmlEntities');
     $password->addFilter('StringTrim');
     $password->setRequired(true)->addErrorMessage('Password Required');
     $password->addValidator('StringLength', true, array(0, 255))->addErrorMessage('Required Field');
     $link = new Zend_Form_Element_Note('forgot_password', array('value' => '<a href="#" id="link">Forgot your password ?</a>'));
     $submit = new Zend_Form_Element_Submit('SignIn');
     $submit->setLabel('Sign In');
     $submit->setAttrib('class', 'btn btn-info');
     $register = new Zend_Form_Element_Button('register');
     $register->setLabel('Register');
     $register->setAttrib('class', 'btn btn-warning');
     $this->addElements(array($email, $password, $submit, $register, $link));
     $this->setElementDecorators(array('ViewHelper'));
     $submit->setDecorators(array('ViewHelper'));
     $register->setDecorators(array('ViewHelper'));
     $this->setDecorators(array('FormElements', 'Form'));
 }
开发者ID:bogdanmatra,项目名称:ibm-hackathon,代码行数:35,代码来源:Login.php

示例15: init

 public function init()
 {
     $nome = new Zend_Form_Element_Text('nome', array('label' => 'Nome:', 'required' => true));
     $val = new Zend_Validate_StringLength(array('min' => 10));
     $nome->addValidator($val);
     $upper = new Zend_Filter_StringToUpper();
     $nome->addFilter($upper);
     $this->addElement($nome);
     $email = new Zend_Form_Element_Text('email', array('label' => 'Email:'));
     $isEmail = new Zend_Validate_EmailAddress();
     $email->addValidator($isEmail);
     $this->addElement($email);
     $senha = new Zend_Form_Element_Password('senha', array('label' => 'Senha:', 'required' => true));
     $lenghtSenha = new Zend_Validate_StringLength(array('min' => 5, 'max' => 15));
     $senha->addValidator($lenghtSenha);
     $this->addElement($senha);
     $endereco = new Zend_Form_Element_Text('endereco', array('label' => 'Endereço:'));
     $this->addElement($endereco);
     $bairro = new Zend_Form_Element_Text('bairro', array('label' => 'Bairro:'));
     $this->addElement($bairro);
     $cep = new Zend_Form_Element_Text('cep', array('label' => 'CEP:'));
     $this->addElement($cep);
     $pais = new Zend_Form_Element_Text('pais', array('label' => 'País:'));
     $this->addElement($pais);
     $botao = new Zend_Form_Element_Submit('botao', array('label' => 'Salvar'));
     $this->addElement($botao);
 }
开发者ID:JoaoAntonioMaruti,项目名称:AulasUnipar2015,代码行数:27,代码来源:Cliente.php


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