本文整理汇总了PHP中Zend_Form_Element_Password类的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form_Element_Password类的具体用法?PHP Zend_Form_Element_Password怎么用?PHP Zend_Form_Element_Password使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Zend_Form_Element_Password类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($options = null)
{
$this->_disabledDefaultActions = true;
$this->_addRequiredAsterisks = false;
parent::__construct($options);
$baseDir = $this->getView()->baseUrl();
$this->getView()->headLink()->appendStylesheet("{$this->getView()->baseUrl()}/themes/default/css/login.css", 'all');
$this->setAttrib('class', 'login');
$regexValidate = new Cible_Validate_Email();
$regexValidate->setMessage($this->getView()->getCibleText('validation_message_emailAddressInvalid'), 'regexNotMatch');
$email = new Zend_Form_Element_Text('email');
$email->setLabel($this->getView()->getClientText('login_form_email_label'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addFilter('StringToLower')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->addValidator($regexValidate)->setAttrib('class', 'loginTextInput');
$this->addElement($email);
$password = new Zend_Form_Element_Password('password');
$password->setLabel($this->getView()->getClientText('login_form_password_label'))->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('class', 'loginTextInput')->setRequired(true)->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))));
$this->addElement($password);
// checkbox for client persistance
$status = new Zend_Form_Element_Checkbox('stayOn');
$status->setLabel($this->getView()->getClientText('login_form_stayOn_label'));
$status->setValue(1);
$status->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd'))));
$this->addElement($status);
// Submit button
$submit = new Zend_Form_Element_Submit('submit_login');
$submit->setLabel('')->setAttrib('class', 'subscribeButton-' . Zend_Registry::get("languageSuffix"));
$submit->setDecorators(array('ViewHelper', array(array('row' => 'HtmlTag'), array('tag' => 'dd'))));
$this->addElement($submit);
$this->setAttrib('class', 'login-form');
}
示例2: __construct
public function __construct($option = null)
{
parent::__construct($option);
$this->setName('login');
$username = new Zend_Form_Element_Text('username');
$username->setAttrib('class', "form-control")->setAttrib('placeholder', "Хэрэглэгчийн нэр")->setRequired(true)->setLabel("Colden compass - ийн хэрэглэгчийн нэвтрэх хэсэг")->setAttrib('class', "form-control");
$password = new Zend_Form_Element_Password('password');
$password->setAttrib('class', "form-control")->setAttrib('placeholder', "Нууц үг")->setRequired(true);
$login = new Zend_Form_Element_Submit('login');
$login->setLabel('Нэвтрэх')->setAttrib('class', 'btn')->setAttrib('class', "form-control");
$this->addElement($username);
$this->addElement($password);
/*
$this->addElement('captcha', 'captcha', array(
'class' => 'form-control',
'required' => true,
'placeholder' => 'Дээрхи кодыг оруулна уу',
'captcha' => array(
'captcha' => 'Figlet',
'wordLen' => 3,
'timeout' => 300
)
));
*/
$this->addElement($login);
$this->setMethod('post');
}
示例3: init
/**
* Form init
*
*/
public function init()
{
$this->setMethod('post');
$this->addElement('text', 'first_name', array('label' => 'First Name*', 'placeholder' => 'e.g. John', 'class' => 'input', 'required' => true, 'filters' => array('StringTrim')));
$this->addElement('text', 'last_name', array('label' => 'Last Name*', 'placeholder' => 'e.g. Smith', 'class' => 'input', 'required' => true, 'filters' => array('StringTrim')));
//http://stackoverflow.com/questions/8014011/queyring-database-for-existing-username-with-zend-and-doctrine
$this->addElement('text', 'username', array('label' => 'Username*', 'placeholder' => 'e.g. smithj01', 'class' => 'input', 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('StringLength', true, array('min' => 4, 'messages' => array(Zend_Validate_StringLength::TOO_SHORT => 'Account username must be at least %min% characters'))), array('Regex', true, array('pattern' => '/^\\w(?:[\\w\\d\\.\\-_]+)(?:\\w|\\d)$/', 'messages' => array(Zend_Validate_Regex::NOT_MATCH => "The username contained invalid characters"))))));
$frmPassword1 = new Zend_Form_Element_Password('password', 'password', array('validators' => array(array('StringLength', false, array('min' => 6, 'messages' => array(Zend_Validate_StringLength::TOO_SHORT => 'Password must be at least %min% characters long.'))))));
$frmPassword1->setLabel('Password*')->setAttrib('class', 'col-md-7 col-xs-1 form-control input')->setRequired('true')->addFilter(new Zend_Filter_StringTrim());
//->addValidator('StringLength', false, array(6, 20))
$this->addElement($frmPassword1);
$frmPassword2 = new Zend_Form_Element_Password('confirm_password');
$frmPassword2->setLabel('Confirm Password*')->setAttrib('class', 'col-md-7 col-xs-1 form-control input')->setRequired('true')->addFilter(new Zend_Filter_StringTrim())->addValidator('StringLength', false, array(6, 20))->addValidator(new Zend_Validate_Identical('password'));
$this->addElement($frmPassword2);
// $this->addElement('text', 'password', array(
// 'label' => 'Password (Visible!)*',
// 'class' => 'input',
// 'required' => true,
// 'filters' => array('StringTrim'),
// 'validators' => array(
// array('validator' => 'StringLength', 'options' => array(6, 20))
// )
// ));
$this->addElement('select', 'role', array('label' => 'Role*', 'class' => 'input', 'required' => true, 'filters' => array('StringTrim'), 'multiOptions' => array('reviewer' => 'reviewer', 'admin' => 'admin')));
$fileUploader = new Zend_Form_Element_File('photo');
$fileUploader->setLabel('Photo (max 2MB, JPEG)')->setAttrib('class', 'input')->setDestination(Zend_Registry::get('uploadPath'));
$fileUploader->addValidator('Count', false, 1);
$fileUploader->addValidator('Size', false, 2048000);
$fileUploader->addValidator('Extension', false, 'jpg,jpeg');
$this->addElement($fileUploader, 'photo');
$this->addElement('submit', 'submit', array('ignore' => true, 'class' => 'submit', 'label' => 'Add User'));
}
示例4: _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));
}
示例5: init
public function init()
{
/*
* Some people consider this to be "interface" stuff,
* to be done in the view. Personally, I think 'action' and 'method'
* can be done here, though the fact that we need the view object
* in order to ender the url for the action suggests that it, too, should
* be in the view. But 'name' and 'attribs' really are kind of view-ish.
*
* Still, I like the idea that the view-script is so simple, just render the form.
*
* @todo To be discussed.
*/
$this->setMethod('post')->setAction($this->getView()->url(array('module' => 'auth', 'controller' => 'login', 'action' => 'index')))->setAttrib('class', 'box')->setName('Login');
# Email
$email = new Zend_Form_Element_Text('email');
$email->setLabel('Email')->setRequired(TRUE)->addFilter('StripTags')->addFilter('StringTrim')->addFilter('StringToLower')->addValidator('NotEmpty')->addValidator('EmailAddress');
# Password
$password = new Zend_Form_Element_Password('password');
$password->setLabel('Password')->setRequired(TRUE)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
$hash = new Zend_Form_Element_Hash('csrf', array('salt' => 'unique'));
$hash->setTimeout(300)->addErrorMessage('Form timed out. Please reload the page & try again');
# Submit
$submit = new Zend_Form_Element_Submit('login');
# Create
$this->addElements(array($email, $password, $submit));
}
开发者ID:MarS2806,项目名称:Zend-Framework--Doctrine-ORM--PHPUnit--Ant--Jenkins-CI--TDD-,代码行数:27,代码来源:Login.php
示例6: 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
}
示例7: init
/**
* Overrides init() in Zend_Form
*
* @access public
* @return void
*/
public function init()
{
// init the parent
parent::init();
// set the form's method
$this->setMethod('post');
$username = new Zend_Form_Element_Text('username');
// $this->t = Zend_Registry::get('Zend_Translate');
$username->setOptions(array('label' => $this->t('Username'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty')));
$this->addElement($username);
$password = new Zend_Form_Element_Password('password');
$password->setOptions(array('label' => $this->t('Password'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty')));
$this->addElement($password);
$authentification = new LoginAttempt();
if ($authentification->canAttemptToLogin() == FALSE) {
$captcha = new Zend_Form_Element_Captcha('captcha', array('label' => $this->t("no humain"), 'captcha' => array("captcha" => "Image", "wordLen" => 4, "font" => "font/tahoma.ttf", "height" => 100, "width" => 300, "fontSize" => 50, "imgDir" => "data/captchas", "imgUrl" => "data/captchas")));
$this->addElement($captcha);
}
$connexion = new Zend_Form_Element_Submit('Connexion');
$connexion->setOptions(array('label' => $this->t('Log In')));
$connexion->setDecorators(array('ViewHelper', array('HtmlTag', array('tag' => 'dd', 'openOnly' => true))));
$this->addElement($connexion);
$inscription = new Zend_Form_Element_Submit('inscription');
$inscription->setOptions(array('label' => $this->t('Sign Up')));
$inscription->setDecorators(array('ViewHelper', array('HtmlTag', array('tag' => 'dd', 'closeOnly' => true))));
$this->addElement($inscription);
$this->clearDecorators();
}
示例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;
}
示例9: init
public function init()
{
$this->setName('user');
$id = new Zend_Form_Element_Hidden('id');
$id->addFilter('Int');
$id->removeDecorator('label');
$name = new Zend_Form_Element_Text('name');
$name->setLabel('name')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml'))));
$password = new Zend_Form_Element_Password('password');
$password->setLabel('Password')->addValidator('NotEmpty', true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('StringLength', false, array(3, 20))->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml'))));
$date = new Zend_Form_Element_Text('date');
$date->setLabel('Date')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml'))));
$email = new Zend_Form_Element_Text('email');
$email->setLabel('Email')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('emailAddress', TRUE)->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml'))));
$status = new Zend_Form_Element_Text('status');
$status->setLabel('status')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml'))));
$person_id = new Zend_Form_Element_Text('person_id');
$person_id->setLabel('person_id')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml'))));
$validation_code = new Zend_Form_Element_Text('validation_code');
$validation_code->setLabel('validation')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml'))));
$phone = new Zend_Form_Element_Text('phone');
$phone->setLabel('Phone')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml'))));
$role_id = new Zend_Form_Element_Select('role_id');
$role_id->setLabel('Role')->setRequired(true)->addValidator('NotEmpty', true)->setmultiOptions($this->_selectOptionsRole())->setAttrib('maxlength', 200)->setAttrib('size', 1)->setAttrib("class", "toolboxdrop")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_select.phtml'))));
$company_id = new Zend_Form_Element_Select('company_id');
$company_id->setLabel('company')->setRequired(true)->addValidator('NotEmpty', true)->setmultiOptions($this->_selectOptionsCompany())->setAttrib('maxlength', 200)->setAttrib('size', 1)->setAttrib("class", "toolboxdrop")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_select.phtml'))));
$submit = new Zend_Form_Element_Submit('submit');
$submit->setValue('Guardar')->setAttrib('id', 'submitbutton')->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_submit.phtml'))))->setAttrib('class', 'btn')->removeDecorator('label');
$add_contact = new Zend_Form_Element_Checkbox('add_contact');
$add_contact->setLabel('add contact')->setRequired(true);
$this->addElements(array($id, $name, $password, $date, $email, $status, $validation_code, $person_id, $phone, $role_id, $company_id, $add_contact, $submit));
}
示例10: init
public function init()
{
$this->setName('f2')->setMethod('post')->setAttribs(array('id' => 'user'));
$id = new Zend_Form_Element_Hidden('id');
$id->addFilter('Int')->removeDecorator('label');
$username = new Zend_Form_Element_Text('ten_dang_nhap');
$username->setLabel('Tên đăng nhập (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addFilter('StringToLower')->addValidator('NotEmpty')->addValidator(new Zend_Validate_StringLength(0, 32))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 83%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'ten_dang_nhap', 'class' => 'text-input'));
$password = new Zend_Form_Element_Password('mat_khau');
$password->setLabel('Mật khẩu (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'mat_khau', 'class' => 'text-input'));
$repassword = new Zend_Form_Element_Password('mat_khau_2');
$repassword->setLabel('Nhập lại mật khẩu (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator(new Zend_Validate_Identical('mat_khau'))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'mat_khau_2', 'class' => 'text-input'));
$ho = new Zend_Form_Element_Text('ho');
$ho->setLabel('Họ (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->addValidator(new Zend_Validate_StringLength(0, 100))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 83%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'ho', 'class' => 'text-input'));
$ten = new Zend_Form_Element_Text('ten');
$ten->setLabel('Tên (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->addValidator(new Zend_Validate_StringLength(0, 20))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'ten', 'class' => 'text-input'));
$ngay_sinh = new Zend_Form_Element_Text('ngay_sinh');
$ngay_sinh->setLabel('Ngày sinh (*)')->setDescription('(dd-mm-YYYY)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array('Description', array('tag' => 'span')), array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'ngay_sinh', 'class' => 'text-input'));
$email = new Zend_Form_Element_Text('email');
$email->setLabel('Email (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->addValidator(new Zend_Validate_EmailAddress())->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'email', 'class' => 'text-input'));
$submitCon = new Zend_Form_Element_Submit('submitCon');
$submitCon->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button'));
$submitExit = new Zend_Form_Element_Submit('submitExit');
$submitExit->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button'));
$url = new Zend_View_Helper_Url();
$link = $url->url(array('module' => 'admin', 'controller' => 'index', 'action' => 'index'));
$cancel = new Zend_Form_Element_Button('cancel');
$cancel->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button', 'onclick' => 'window.location.href="' . $link . '"'));
$this->addElements(array($id, $username, $password, $repassword, $ho, $ten, $ngay_sinh, $email, $submitCon, $submitExit, $cancel));
$this->addDisplayGroup(array('submitCon', 'submitExit', 'cancel'), 'submitbtn', array('decorators' => array('FormElements', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'colspan' => 2)), array(array('row' => 'HtmlTag'), array('tag' => 'td')), array('HtmlTag', array('tag' => 'tr', 'id' => 'btn')))));
$this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table')), 'Form'));
}
示例11: init
public function init()
{
$this->setName('LoginForm')->setMethod('post')->setAction('validate');
$id = new Zend_Form_Element_Hidden('user_id');
$id->addFilter('Int');
$email = new Zend_Form_Element_Text('email');
$email->setLabel('Email address')->addValidator('EmailAddress')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
//$this->addElement(array($email_id));
//->addFilter('stringtoLower');
$email->setAttrib('class', 'input');
$password = new Zend_Form_Element_Password('password');
$password->setLabel('Password')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
//->addValidator('StringLength',false,array(12));
//->setRequired(true);
//$this->addElement(array('$password'));
$password->setAttrib('class', 'input');
$submit = new Zend_Form_Element_Submit('Login');
$submit->setLabel('Login here');
$submit->setAttrib('id', 'submitbutton');
//id=submitbutton
/*$register = new Zend_Form_Element_Submit('Register');
$register->setLabel('Register here')
->setIgnore(true);
$register->setAttrib('id', 'submitbutton');*/
$this->addElements(array($id, $email, $password, $submit));
}
示例12: 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('');
}
示例13: init
public function init()
{
// if (!$this->hasTranslator()) {
// $this->setTranslator(Zend_Registry::get('Zend_Translate'));
// }
$userid = new Zend_Form_Element_Hidden('UserID');
$username = new Zend_Form_Element_Text('Username');
$username->setOptions(array('label' => 'Username', 'required' => TRUE, 'filters' => array('StringTrim')));
$password = new Zend_Form_Element_Password('Password');
$password->setOptions(array('label' => 'Password', 'required' => TRUE));
$repassword = new Zend_Form_Element_Password('RePassword');
$repassword->setOptions(array('label' => 'Retype Password', 'required' => TRUE));
$role = new Zend_Form_Element_Hidden('Role');
$fullname = new Zend_Form_Element_Text('FullName');
$fullname->setOptions(array('label' => 'FullName'));
$email = new Zend_Form_Element_Text('Email');
$email->setOptions(array('label' => 'Email', 'required' => TRUE));
$birthday = new Zend_Form_Element_Text("Birthday");
$birthday->setOptions(array('label' => 'Birthday'));
$group = new Zend_Form_Element_Text('Group');
$group->setOptions(array('label' => 'Group'));
$phone = new Zend_Form_Element_Text('Phone');
$phone->setOptions(array('label' => 'Phone'));
$address = new Zend_Form_Element_Text('Address');
$address->setOptions(array('label' => 'Address'));
$submit = new Zend_Form_Element_Submit('Submit');
$this->setName('profile-form')->setMethod(Zend_Form::METHOD_POST)->setEnctype(Zend_Form::ENCTYPE_URLENCODED)->addElements(array($userid, $username, $password, $repassword, $role, $fullname, $email, $birthday, $group, $phone, $address, $submit))->setDecorators(array('FormElements', 'Errors', array('HtmlTag', array('tag' => 'table', 'cellpadding' => '3')), 'Form'));
}
示例14: _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;
}
示例15: 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');
}
}