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; }
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() { // 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'))); }
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_Field(); $elements = array(); // Add name field $input = new Zend_Form_Element_Text('host', array('required' => true, 'label' => 'SMTP Host:', 'id' => 'host', 'placeholder' => 'Type something..', 'class' => 'form-control', 'value' => 'smtp.gmail.com')); $input->addValidators(array(new Zend_Validate_NotEmpty())); $input->addDecorator($decoratorField); $elements[] = $input; // Add category field $select = new Zend_Form_Element_Select('stype', array('required' => true, 'label' => 'Security:', 'id' => 'stype', 'class' => 'form-control')); $select->addMultiOption('TLS', 'TLS'); $select->addMultiOption('SSH', 'SSH'); $select->setValue('TLS'); $select->addDecorator($decoratorField); $elements[] = $select; // Add Price field $input = new Zend_Form_Element_Text('port', array('required' => true, 'label' => 'Port:', 'id' => 'port', 'placeholder' => 'Type something..', 'class' => 'form-control', 'min' => 0, 'step' => '1', 'type' => 'number', 'value' => '587')); $min = new Zend_Validate_GreaterThan(0); $input->addValidators(array(new Zend_Validate_Digits(), $min, new Zend_Validate_NotEmpty())); $input->addDecorator($decoratorField); $elements[] = $input; $input = new Zend_Form_Element_Text('email', array('required' => true, 'label' => 'SMTP Email Address:', 'id' => 'email', 'placeholder' => 'Your email..', 'class' => 'form-control', 'type' => 'email', 'value' => '*****@*****.**')); $input->addValidators(array(new Zend_Validate_EmailAddress(), new Zend_Validate_NotEmpty())); $input->addDecorator($decoratorField); $elements[] = $input; // Add category field $input = new Zend_Form_Element_Password('password1', array('required' => true, 'label' => 'Password:'******'id' => 'password1', 'class' => 'form-control', 'placeholder' => 'Your SMTP password..')); $input->addValidators(array(new Zend_Validate_NotEmpty())); $input->addDecorator($decoratorField); $elements[] = $input; // Add category field $input = new Zend_Form_Element_Password('password2', array('required' => true, 'label' => 'Password Again:', 'id' => 'password2', 'class' => 'form-control', 'placeholder' => 'Your SMTP password again..', 'validators' => array(array('identical', false, array('token' => 'password1'))))); $input->addDecorator($decoratorField); $elements[] = $input; //Add Submit button $input = new Zend_Form_Element_Submit('submit', array('Label' => ' ', 'class' => 'btn btn-info', 'value' => 'Add New Configuration')); $input->addDecorator($decoratorField); $elements[] = $input; $this->addElements($elements); $this->addDisplayGroup(array('host', 'stype', 'port', 'email', 'password1', 'password2', 'submit'), 'displgrp', array('legend' => 'Add Products', 'decorators' => array('FormElements', 'Fieldset'))); return $this; }
public function __construct($options = null) { parent::__construct($options); $this->setName('create_account'); $element = new Zend_Form_Element_Text('email', array('disableLoadDefaultDecorators' => true)); $element->addDecorator('ViewHelper')->setRequired(true)->addValidator('EmailAddress')->addErrorMessage('Fornire un indirizzo email'); $this->addElement($element); $element = new Zend_Form_Element_Password('password', array('disableLoadDefaultDecorators' => true)); $element->addDecorator('ViewHelper')->setRequired(true)->setAttrib('autocomplete', 'off')->addErrorMessage('Fornire una password'); $this->addElement($element); $element = new Zend_Form_Element_Password('confirm_password', array('disableLoadDefaultDecorators' => true)); $element->addDecorator('ViewHelper')->setRequired(true)->setAttrib('autocomplete', 'off')->addValidator(new Frontend_Form_Validate_IdenticalFormValues('password'), true)->addErrorMessage('Le due password non corrispondono'); $this->addElement($element); $element = new Zend_Form_Element_Hash('___h', array('disableLoadDefaultDecorators' => true)); $element->setSalt('unique')->addDecorator('ViewHelper')->addErrorMessage('Il form non puo\' essere reinviato'); $this->addElement($element); /* $captcha_session = new Zend_Session_Namespace('captcha'); if($captcha_session->tries > 3) { $recaptcha = new Zend_Service_ReCaptcha('6LfK4r0SAAAAABA5P5icMZayuRyiEOeot0k_uhW5', '6LfK4r0SAAAAAJu-NmK7-30Ng4-0J2oe0R15iIoo'); $recaptcha->setOption('theme', 'clean'); $element = new Zend_Form_Element_Captcha('captcha', array( 'disableLoadDefaultDecorators' => true, 'captcha' => 'ReCaptcha', 'captchaOptions' => array( 'captcha' => 'ReCaptcha', 'service' => $recaptcha ) ) ); $element->addErrorMessage('Codice di sicurezza non valido'); $this->addElement($element); } */ $this->clearDecorators(); $this->addDecorator('FormElements'); $this->addDecorator('Form'); }
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 name field $input = new Zend_Form_Element_Text('email', array('required' => true, 'label' => 'Email Address:', 'id' => 'email', 'placeholder' => 'Your email..', 'class' => 'form-control', 'type' => 'email')); $input->addValidators(array(new Zend_Validate_EmailAddress(), new Zend_Validate_NotEmpty())); $input->addDecorator($decoratorField); $elements[] = $input; // Add category field $input = new Zend_Form_Element_Password('password1', array('required' => true, 'label' => 'Password:'******'id' => 'password1', '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 category field $input = new Zend_Form_Element_Password('password2', array('required' => true, 'label' => 'Password Again:', 'id' => 'password2', 'class' => 'form-control', 'placeholder' => 'Your password again..', 'validators' => array(array('identical', false, array('token' => 'password1'))))); $input->addDecorator($decoratorField); $elements[] = $input; // Add code field $input = new Zend_Form_Element_Text('currency_code', array('required' => true, 'label' => 'Currency Code:', 'id' => 'currency_code', 'placeholder' => 'Example USD', 'class' => 'form-control', 'list' => 'currencies', 'autocomplete' => 'off')); $validator = new Zend_Validate_StringLength(array('max' => 3)); $input->addValidators(array($validator, new Zend_Validate_NotEmpty())); $currencyMapper = new Application_Model_CurrencyMapper(); $currencies = $currencyMapper->fetchAllActive(); $decoratorCurrency = new My_Decorator_CurrencyAutocomplete(null, $currencies); $input->addDecorator($decoratorCurrency); $elements[] = $input; //Add Submit button $input = new Zend_Form_Element_Submit('submit', array('Label' => '', 'class' => 'btn btn-default', 'value' => 'SignUp')); $input->addDecorator($decoratorField); $elements[] = $input; $this->addElements($elements); $this->addDisplayGroup(array('email', 'password1', 'password2', 'currency_code', 'submit'), 'displgrp', array('decorators' => array('FormElements'))); }
public function __construct($options = null) { parent::__construct($options); $this->setName('login'); $element = new Zend_Form_Element_Text('email', array('disableDefaultDecorators' => true)); $element->addDecorator('ViewHelper')->addValidator('EmailAddress')->setRequired(true)->addErrorMessage('La mail e\' obbligatoria'); $this->addElement($element); $element = new Zend_Form_Element_Password('password', array('disableDefaultDecorators' => true)); $element->addDecorator('ViewHelper')->setRequired(true)->addErrorMessage('La password e\' obbligatoria'); $this->addElement($element); $element = new Zend_Form_Element_Hash('___h', array('disableDefaultDecorators' => true)); $element->setSalt('unique')->addDecorator('ViewHelper')->addErrorMessage('Il form non deve essere reinviato.'); $this->addElement($element); /* $captcha_session = new Zend_Session_Namespace('captcha'); if($captcha_session->tries > 3) { $recaptcha = new Zend_Service_ReCaptcha('6LfK4r0SAAAAABA5P5icMZayuRyiEOeot0k_uhW5', '6LfK4r0SAAAAAJu-NmK7-30Ng4-0J2oe0R15iIoo'); $recaptcha->setOption('theme', 'clean'); $element = new Zend_Form_Element_Captcha('captcha', array( 'disableDefaultDecorators' => true, 'captcha' => 'ReCaptcha', 'captchaOptions' => array( 'captcha' => 'ReCaptcha', 'service' => $recaptcha ) ) ); $element->addErrorMessage('Codice di sicurezza non valido'); $this->addElement($element); } */ $this->clearDecorators(); $this->addDecorator('FormElements')->addDecorator('Form'); }