本文整理汇总了PHP中Zend_Form_Element_Password::setRequired方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form_Element_Password::setRequired方法的具体用法?PHP Zend_Form_Element_Password::setRequired怎么用?PHP Zend_Form_Element_Password::setRequired使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Form_Element_Password
的用法示例。
在下文中一共展示了Zend_Form_Element_Password::setRequired方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public function init()
{
$this->clearDecorators();
$this->addElementPrefixPath('Pas_Validate', 'Pas/Validate/', 'validate');
$this->addPrefixPath('Pas_Form_Element', 'Pas/Form/Element/', 'element');
$decorators = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'append', 'class' => 'error', 'tag' => 'li')), array('Label', array('separator' => ' ', 'requiredSuffix' => ' *', 'class' => 'leftalign')), array('HtmlTag', array('tag' => 'li')));
$oldpassword = new Zend_Form_Element_Password('oldpassword');
$oldpassword->setLabel('Your old password: ');
$oldpassword->setRequired(true)->addValidator('RightPassword')->addFilters(array('StripTags', 'StringTrim'));
$oldpassword->setDecorators($decorators);
$password = new Zend_Form_Element_Password("password");
$password->setLabel("New password:")->addValidator("NotEmpty")->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->setDecorators($decorators)->addValidator('IdenticalField', false, array('password2', ' confirm password field'));
// identical field validator with custom messages
$hash = new Zend_Form_Element_Hash('csrf');
$hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(60);
$this->addElement($hash);
$password2 = new Zend_Form_Element_Password("password2");
$password2->setLabel("Confirm password:")->addValidator("NotEmpty")->addFilters(array('StripTags', 'StringTrim'))->setRequired(true)->setDecorators($decorators);
$submit = new Zend_Form_Element_Submit('submit');
$submit->clearDecorators();
$submit->addDecorators(array(array('ViewHelper'), array('HtmlTag', array('tag' => 'div', 'class' => 'submit'))));
$submit->setAttrib('class', 'large')->setLabel('Change password');
$this->addElement($submit);
$this->addElements(array($oldpassword, $password, $password2, $submit));
$this->addDisplayGroup(array('oldpassword', 'password', 'password2'), 'userdetails');
$this->addDecorator('FormElements')->addDecorator(array('ListWrapper' => 'HtmlTag'), array('tag' => 'div'))->addDecorator('FieldSet')->addDecorator('Form');
$this->userdetails->removeDecorator('DtDdWrapper');
$this->userdetails->removeDecorator('FieldSet');
$this->userdetails->addDecorator(array('DtDdWrapper' => 'HtmlTag'), array('tag' => 'ul'));
$this->addDisplayGroup(array('submit'), 'submit');
$this->setLegend('Edit account details: ');
}
示例2: 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');
}
示例3: setForm
function setForm()
{
$form=new Zend_Form;
$form->setMethod('post')->setAction('');
$user_login = new Zend_Form_Element_Text('user_login');
$user_login->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Tên đăng nhập không được để trống'));
$user_pass = new Zend_Form_Element_Password('user_pass');
$user_pass->setAttrib('renderPassword', true);
$user_pass->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Mật khẩu không được để trống'));
$user_fullname = new Zend_Form_Element_Text('user_fullname');
$user_fullname->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Tên người dùng không được để trống'));
$user_email = new Zend_Form_Element_Text('user_email');
$user_email->addValidator('EmailAddress',true,array('messages'=>'Địa chỉ email không hợp lệ'));
$user_email->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Email không được để trống'));
$user_address = new Zend_Form_Element_Text('user_address');
$user_address->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Địa chỉ không được để trống'));
$user_login->removeDecorator('HtmlTag')->removeDecorator('Label');
$user_pass->removeDecorator('HtmlTag')->removeDecorator('Label');
$user_fullname->removeDecorator('HtmlTag')->removeDecorator('Label');
$user_email->removeDecorator('HtmlTag')->removeDecorator('Label');
$user_address->removeDecorator('HtmlTag')->removeDecorator('Label');
$form->addElements(array($user_login,$user_pass,$user_fullname,$user_email,$user_address));
return $form;
}
示例4: 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();
}
示例5: 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);
}
示例6: _getPasswordElement
private function _getPasswordElement()
{
$credentialsVaidator = new Form_Validate_Credentials();
$passwordElement = new Zend_Form_Element_Password('password');
$passwordElement->setRequired(true)->setLabel('Password')->addValidator($credentialsVaidator);
return $passwordElement;
}
示例7: _setupElements
private function _setupElements()
{
$translate = Zend_Registry::get('Zend_Translate');
$this->setAttrib('id', 'signupForm');
$this->setTranslator($translate);
$email = new Zend_Form_Element_Text('email');
$email->setRequired(true)->addFilter('StringTrim')->addFilter('StripTags')->addValidator('NotEmpty')->removeDecorator('HtmlTag')->removeDecorator('DtDWrapper')->removeDecorator('label')->setAttrib('id', 'email')->addValidator('EmailAddress');
$email->addValidator(new Ziown_Form_Validate_EmailAddress(), false);
$email->getValidator('NotEmpty')->setMessage('Email Address is Required', 'isEmpty');
$username = new Zend_Form_Element_Text('username');
$username->setRequired(true)->addFilter('StringTrim')->addFilter('StripTags')->addValidator('NotEmpty')->removeDecorator('HtmlTag')->removeDecorator('DtDWrapper')->removeDecorator('label')->setAttrib('id', 'username');
$username->addValidator(new Ziown_Form_Validate_UserName());
$username->getValidator('NotEmpty')->setMessage('User name is Required', 'isEmpty');
$password = new Zend_Form_Element_Password('password');
$password->setRequired(true)->removeDecorator('HtmlTag')->removeDecorator('DtDWrapper')->removeDecorator('label')->setAttrib('id', 'txt-password')->setErrorMessages(array('Password is required'));
$identValidator = new Zend_Validate_Identical($_POST['password']);
$identValidator->setMessages(array('notSame' => 'Password doesn\'t match!', 'missingToken' => 'Password doesn\'t match!'));
$confirm_password = new Zend_Form_Element_Password('confirm_password');
$confirm_password->setRequired(true)->removeDecorator('HtmlTag')->removeDecorator('DtDWrapper')->removeDecorator('label')->setAttrib('id', 'txt-confirm-password')->addValidator($identValidator);
$signup = new Zend_Form_Element_Submit('signup');
$signup->setLabel('Sign Up');
$signup->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->setAttrib('class', 'u-login');
$this->setDecorators(array(array('ViewScript', array('script' => 'signup.phtml'))));
$this->addElements(array($username, $password, $confirm_password, $signup, $email));
}
示例8: 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));
}
示例9: init
public function init()
{
$this->setName('registerForm');
$this->setMethod('post');
$this->setAction('/user/register/');
$user = new Zend_Form_Element_Text('user');
$user->setLabel('Username');
$user->setRequired(true);
$user->addValidator('Alnum', false);
$user->addValidator('StringLength', true, array(3, 30));
//$user->addValidator('Db_NoRecordExists', true, array('user', 'user') );
$password = new Zend_Form_Element_Password('password');
$password->setLabel('Password');
$password->setRenderPassword(true);
$password->setRequired(true);
$password->addValidator('StringLength', true, array(5, 50));
$name = new Zend_Form_Element_Text('name');
$name->setLabel('Full Name');
$name->setRequired(true);
$name->addValidator('StringLength', true, array(3, 128));
$email = new Zend_Form_Element_Text('email');
$email->setLabel('Email');
$email->setRequired(true);
$email->addValidator('EmailAddress', true);
$email->addValidator('StringLength', true, array(3, 128));
$submit = new Zend_Form_Element_Submit('register');
$submit->setLabel('Register');
$hash = new Zend_Form_Element_Hash('hash');
$this->setElements(array($user, $password, $name, $email, $submit, $hash));
}
示例10: 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))));
}
示例11: __construct
public function __construct($option = null)
{
parent::__construct($option);
$this->setName('register');
$this->setAttrib('class', 'input-group');
$username = new Zend_Form_Element_Text('username');
$username->setRequired(true)->setAttrib('class', "form-control")->addFilter(new Zend_Filter_StringTrim())->addValidator(new Zend_Validate_StringLength(4, 20))->addValidator('regex', true, array('/^[(a-zA-Z0-9)]+$/'))->setAttrib('placeholder', "Хэрэглэгчийн нэр")->addValidator('Db_NoRecordExists', true, array('table' => 'users', 'field' => 'username'))->setLabel("Дүн.мн хэрэглэгчийн бүртгүүлэх хэсэг");
$password = new Zend_Form_Element_Password('password');
$password->setRequired(true)->setAttrib('placeholder', "Нууц үг")->setAttrib('class', "form-control")->addFilter(new Zend_Filter_StringTrim())->addValidator(new Zend_Validate_StringLength(8, 20));
$confirmPassword = new Zend_Form_Element_Password('confirm_password');
$confirmPassword->setAttrib('class', "form-control");
$token = Zend_Controller_Front::getInstance()->getRequest()->getPost('password');
$confirmPassword->setRequired(true)->setAttrib('placeholder', "Нууц үгээ давтана уу?")->setAttrib('class', "form-control")->addFilter(new Zend_Filter_StringTrim())->addValidator(new Zend_Validate_Identical(trim($token)));
$firstname = new Zend_Form_Element_Text('firstname');
$firstname->setAttrib('placeholder', "Таны нэр")->addFilter(new Zend_Filter_StringTrim())->addValidator(new Zend_Validate_NotEmpty())->setAttrib('class', "form-control");
$lastname = new Zend_Form_Element_Text('lastname');
$lastname->setAttrib('placeholder', "Таны овог")->addFilter(new Zend_Filter_StringTrim())->addValidator(new Zend_Validate_NotEmpty())->setAttrib('class', "form-control");
$date = new Zend_Form_Element_Text('date');
$date->setAttrib('placeholder', "Төрсөн он сар өдөр (он-сар-өдөр)")->addFilter(new Zend_Filter_StringTrim())->addValidator(new Zend_Validate_NotEmpty())->setAttrib('class', "form-control");
$email = new Zend_Form_Element_Text('email');
$email->addFilters(array('StringTrim', 'StripTags'))->setAttrib('placeholder', "Таны цахим хаяг")->addValidator('EmailAddress', TRUE)->addValidator('Db_NoRecordExists', true, array('table' => 'users', 'field' => 'E-mail'))->addValidator(new Zend_Validate_NotEmpty())->setAttrib('class', "form-control");
$submit = new Zend_Form_Element_Submit('register');
$submit->setLabel('Бүртгүүлэх')->setAttrib('class', 'btn');
$this->addElement($username);
$this->addElement($password);
$this->addElement($confirmPassword);
$this->addElement($firstname);
$this->addElement($lastname);
$this->addElement($date);
$this->addElement($email);
$this->addElement($submit);
$this->setMethod('post');
}
示例12: getFormLogin
private function getFormLogin()
{
$form = new Zend_Form(array('disableLoadDefaultDecorators' => true));
$email = new Zend_Form_Element_Text('login', array('disableLoadDefaultDecorators' => true));
$email->addDecorator('ViewHelper');
$email->addDecorator('Errors');
$email->setRequired(true);
$email->setAttrib('class', 'form-control');
$email->setAttrib('placeholder', 'Login');
$email->setAttrib('required', 'required');
$email->setAttrib('autofocus', 'autofocus');
$password = new Zend_Form_Element_Password('password', array('disableLoadDefaultDecorators' => true));
$password->addDecorator('ViewHelper');
$password->addDecorator('Errors');
$password->setRequired(true);
$password->setAttrib('class', 'form-control');
$password->setAttrib('placeholder', 'Hasło');
$password->setAttrib('required', 'required');
$password->setAttrib('autofocus', 'autofocus');
$submit = new Zend_Form_Element_Submit('submit', array('disableLoadDefaultDecorators' => true));
$submit->setAttrib('class', 'btn btn-lg btn-primary btn-block');
$submit->setOptions(array('label' => 'Zaloguj'));
$submit->addDecorator('ViewHelper')->addDecorator('Errors');
$form->addElement($email)->addElement($password)->addElement($submit);
return $form;
}
示例13: 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
}
示例14: init
public function init()
{
$obj = new Application_Model_DbTable_User();
$primaryKey = $obj->getPrimaryKey();
$this->setMethod('post');
$this->setEnctype('multipart/form-data');
$this->setAttrib('codempr', $primaryKey);
$this->setAction('/admin/index/update-pass');
$e = new Zend_Form_Element_Password('password');
$e->setRequired(true);
$e->setAttrib('class', 'inpt-medium');
$e->setAttrib('placeholder', 'Contraseña actual');
$this->addElement($e);
$e = new Zend_Form_Element_Password('confirmone');
$e->setRequired(true);
$e->setAttrib('class', 'inpt-medium');
$e->setAttrib('placeholder', 'Nueva Contraseña');
$this->addElement($e);
$e = new Zend_Form_Element_Password('confirmtwo');
$e->setRequired(true);
$e->setAttrib('class', 'inpt-medium');
$e->setAttrib('placeholder', 'Repetir Nueva Contraseña');
$this->addElement($e);
$e = new Zend_Form_Element_Submit('Cambiar');
$this->addElement($e);
foreach ($this->getElements() as $element) {
$element->removeDecorator('Label');
$element->removeDecorator('DtDdWrapper');
$element->removeDecorator('HtmlTag');
}
}
示例15: init
public function init()
{
$this->setMethod('post');
$this->setAction('/login');
$this->setOptions(array('class' => 'niceform', 'id' => 'form1'));
$this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table')), 'Form'));
//$this->getDecorator('HtmlTag')->setOptions(array('tag' => 'fieldset'));
/*$this->setDecorators(array(
'Errors',
'FormElements',
array('HtmlTag', array('tag' => 'fieldset')),
'Form'
));*/
$username = new Zend_Form_Element_Text('username');
$username->setLabel('username');
$username->setRequired(true);
$username->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class' => 'element')), array('Label', array('tag' => 'td'), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))));
$pass = new Zend_Form_Element_Password('password');
$pass->setlabel('password');
$pass->setRequired(true);
$pass->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class' => 'element')), array('Label', array('tag' => 'td'), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))));
/*
$pass->setDecorators(array(
'ViewHelper',
'Errors',
array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class' => 'element')),
array(array('label' => 'HtmlTag'), array('tag' => 'td', 'placement' => 'prepend')),
array(array('row' => 'HtmlTag'), array('tag' => 'tr')),
));
*/
$submit = new Zend_Form_Element_Submit('login');
$submit->setLabel('login');
$submit->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class' => 'element')), array(array('label' => 'HtmlTag'), array('tag' => 'td', 'placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
$this->addElements(array($username, $pass, $submit));
}