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'); }
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'); }
/** * 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')); }
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)); }
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)); }
public function init() { $this->setMethod('post'); //The password element. $passwordElement = new Zend_Form_Element_Password('password'); $passwordElement->setRequired(true); $passwordElement->setLabel('New Password:'******'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:'******'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 }
/** * 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(); }
/** 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; }
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)); }
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')); }
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)); }
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(''); }
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')); }
private function _getPasswordElement() { $credentialsVaidator = new Form_Validate_Credentials(); $passwordElement = new Zend_Form_Element_Password('password'); $passwordElement->setRequired(true)->setLabel('Password')->addValidator($credentialsVaidator); return $passwordElement; }
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'); } }
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)); }
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'); }
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)); }
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)); }
public function init() { // initialize form $this->setAction('/signup')->setMethod('post'); $firstname = new Zend_Form_Element_Text('FirstName'); $firstname->setLabel('First name:')->setOptions(array('size' => '35'))->setRequired(true)->addValidator('NotEmpty', true)->addValidator('Alpha', true)->addFilter('HtmlEntities')->addFilter('StringTrim'); $lastname = new Zend_Form_Element_Text('LastName'); $lastname->setLabel('Last name:')->setOptions(array('size' => '35'))->setRequired(true)->addValidator('NotEmpty', true)->addValidator('Alpha', true)->addFilter('HtmlEntities')->addFilter('StringTrim'); // create text input for email address $email = new Zend_Form_Element_Text('Email'); $email->setLabel('Email address:'); $email->setOptions(array('size' => '50'))->setRequired(true)->addValidator('NotEmpty', true)->addValidator('EmailAddress', true)->addFilter('HtmlEntities')->addFilter('StringToLower')->addFilter('StringTrim'); // create text input for name $UserName = new Zend_Form_Element_Text('UserName'); $UserName->setLabel('Username:'******'size' => '50'))->setRequired(true)->addValidator('Alnum')->addFilter('HtmlEntities')->addFilter('StringTrim'); // create text input for password $Password = new Zend_Form_Element_Password('Password'); $Password->setLabel('Password:'******'size' => '50'))->setRequired(true)->addValidator('NotEmpty', true)->addFilter('HtmlEntities')->addFilter('StringTrim'); // create text input for password confirmation $ConfirmPassword = new Zend_Form_Element_Password('ConfirmPassword'); $ConfirmPassword->setLabel('Confirm Password:'******'size' => '50'))->setRequired(true)->addValidator('NotEmpty', true)->addFilter('HtmlEntities')->addFilter('StringTrim'); // create submit button $submit = new Zend_Form_Element_Submit('register'); $submit->setLabel('Register')->setOptions(array('class' => 'submit')); // attach elements to form $this->addElement($firstname)->addElement($lastname)->addElement($email)->addElement($UserName)->addElement($Password)->addElement($ConfirmPassword)->addElement($submit); }
/** * * Change password form * */ public function init() { $cname = explode('_', get_class()); $this->preInit(end($cname)); // use template file $this->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/ChangePassword.phtml')))); $Profiles = new Application_Model_Profiles(); // fields $password_old = new Zend_Form_Element_Password('passwordold'); $password_old->setDecorators(array('ViewHelper', 'Errors'))->setAttrib('autocomplete', 'off')->setRequired(true)->setErrorMessages(array($this->translator->translate('Password is required')))->setLabel($this->translator->translate('Old Password:'******'class', 'form-control'); // check if blank password (facebook-registered user) and remove old password field if so if (Zend_Auth::getInstance()->hasIdentity()) { $profile = $Profiles->getProfile(Zend_Auth::getInstance()->getIdentity()->name); if ($profile->password == '') { $password_old->setAttrib('class', 'hidden'); $password_old->setRequired(false); $password_old->setLabel(''); } } $password1 = new Zend_Form_Element_Password('password1'); $password1->setDecorators(array('ViewHelper', 'Errors'))->setAttrib('autocomplete', 'off')->setRequired(true)->addValidator('StringLength', false, array(5))->setErrorMessages(array($this->translator->translate('Min 5 characters')))->setLabel($this->translator->translate('New Password:'******'class', 'form-control'); $password2 = new Zend_Form_Element_Password('password2'); $password2->setDecorators(array('ViewHelper', 'Errors'))->setAttrib('autocomplete', 'off')->setRequired(true)->addValidator('Identical', false, array('token' => 'password1'))->setErrorMessages(array($this->translator->translate('The passwords do not match')))->setLabel($this->translator->translate('Confirm Password:'******'class', 'form-control'); $submit = new Zend_Form_Element_Submit('changepass'); $submit->setDecorators(array('ViewHelper'))->setLabel($this->translator->translate('Change Password'))->setAttrib('class', 'submit btn btn-default'); $this->addElements(array($password_old, $password1, $password2, $submit)); $this->postInit(); }
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 email field $input = new Zend_Form_Element_Text('email', array('required' => true, 'label' => 'Email Address:', 'id' => 'email', 'placeholder' => 'Your email..', 'class' => 'form-control', 'type' => 'email')); $validator = new Zend_Validate_EmailAddress(); $validator->setOptions(array('domain' => false)); $input->addValidators(array($validator, new Zend_Validate_NotEmpty())); $input->addDecorator($decoratorField); $elements[] = $input; // Add password field $input = new Zend_Form_Element_Password('password', array('required' => true, 'label' => 'Password:'******'id' => 'password', 'class' => 'form-control', 'placeholder' => 'Your password..')); $input->addValidators(array(new Zend_Validate_NotEmpty())); $input->addDecorator($decoratorField); $elements[] = $input; // Add checkbox field $input = new Zend_Form_Element_Checkbox('rememberMe', array('label' => 'Remember me', 'id' => 'rememberMe', 'class' => 'checkbox', 'type' => 'checkbox')); $decoratorCheckBox = new My_Decorator_CheckBox(); $input->addDecorator($decoratorCheckBox); $elements[] = $input; $input = new Zend_Form_Element('resetpass', array('label' => 'Reset your password', 'id' => 'resetpass', 'class' => 'form-control', 'value' => 'resetpass')); $input->addDecorator(new My_Decorator_AnchoraForm()); $elements[] = $input; //Add Submit button $input = new Zend_Form_Element_Submit('submit', array('Label' => '', 'class' => 'btn btn-default', 'value' => 'Login')); $input->addDecorator($decoratorField); $elements[] = $input; $this->addElements($elements); $this->addDisplayGroup(array('email', 'password', 'resetpass', 'rememberMe', 'submit'), 'displgrp', array('decorators' => array('FormElements', 'Fieldset'))); }
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'); }
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; }
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); }
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)); }
/** * Form initialization * * @return void */ public function init() { $this->setName('loginForm'); $this->setElementsBelongTo('loginForm'); $element = new Zend_Form_Element_Text('username'); $element->setLabel('Username')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim'); $this->addElement($element); $element = new Zend_Form_Element_Password('password'); $element->setLabel('Password')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim'); $this->addElement($element); $element = new Zend_Form_Element_Checkbox('rememberMe'); $element->setLabel('Remember me'); $this->addElement($element); /** * @var $request Zend_Controller_Request_Http */ $request = Zend_Controller_Front::getInstance()->getRequest(); $element = new Zend_Form_Element_Hidden('redirect'); $element->setValue($request->getParam('from', '/'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim'); $element->getDecorator('HtmlTag')->setOption('class', 'hidden'); $element->getDecorator('Label')->setOption('tagClass', 'hidden'); $this->addElement($element); $element = new Zend_Form_Element_Submit('submit'); $element->setLabel('Connection'); $this->addElement($element); }
/** * Form initialization * * @return void */ public function init() { $this->addElementPrefixPath('Users_Form_Auth_Validate', dirname(__FILE__) . "/Validate", 'validate'); $this->setName('userRegisterForm'); $username = new Zend_Form_Element_Text('login'); $username->setLabel('User name')->addDecorators($this->_inputDecorators)->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('Alnum')->addValidator('StringLength', false, array(Users_Model_User::MIN_USERNAME_LENGTH, Users_Model_User::MAX_USERNAME_LENGTH))->addValidator('Db_NoRecordExists', false, array(array('table' => 'users', 'field' => 'login'))); $password = new Zend_Form_Element_Password('password'); $password->setLabel('Password')->addDecorators($this->_inputDecorators)->setRequired(true)->setValue(null)->addValidator('StringLength', false, array(Users_Model_User::MIN_PASSWORD_LENGTH))->addValidator('PasswordConfirmation'); $confirmPassword = new Zend_Form_Element_Password('password2'); $confirmPassword->setLabel('Password again')->addDecorators($this->_inputDecorators)->setRequired(true)->setValue(null)->addValidator('StringLength', false, array(Users_Model_User::MIN_PASSWORD_LENGTH)); $email = new Zend_Form_Element_Text('email'); $email->setLabel('Email')->addDecorators($this->_inputDecorators)->setRequired(true)->setValue(null)->addValidator('StringLength', false, array(6))->addValidator('EmailAddress')->addValidator('Db_NoRecordExists', false, array(array('table' => 'users', 'field' => 'email'))); $imgDir = dirname(APPLICATION_PATH) . "/public/captcha"; // check captcha path is writeable if (is_writable($imgDir)) { $captcha = new Zend_Form_Element_Captcha('captcha', array('label' => "Please verify you're a human", 'captcha' => 'Image', 'captchaOptions' => array('captcha' => 'Image', 'wordLen' => 6, 'timeout' => 300, 'imgDir' => $imgDir, 'imgUrl' => '/captcha/', 'font' => dirname(APPLICATION_PATH) . "/data/fonts/Aksent_Normal.ttf"))); } else { $captcha = new Zend_Form_Element_Captcha('captcha', array('label' => "Please verify you're a human", 'captcha' => 'Figlet', 'captchaOptions' => array('wordLen' => 6, 'timeout' => 300))); } $captcha->addDecorators($this->_inputDecorators); $submit = new Zend_Form_Element_Submit('submit'); $submit->setLabel('Register'); $submit->setAttrib('class', 'btn btn-primary'); $this->addElements(array($username, $password, $confirmPassword, $email, $captcha, $submit)); return $this; }
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(); }
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'))); }