public function __construct() { parent::__construct(); $router = new Shared_Controller_Router(); $this->setAction($router->assemble(array(), 'login')); $this->setMethod('post'); // email $email = new Zend_Dojo_Form_Element_TextBox('email'); $email->setLabel(__('Email')); $email->setRequired(true); $this->addElement($email); // password $password = new Zend_Dojo_Form_Element_PasswordTextBox('password'); $password->setLabel(__('Password')); $password->setRequired(true); $this->addElement($password); // remember $remember = new Zend_Dojo_Form_Element_CheckBox('remember'); $remember->setLabel(__('Remember me on this computer')); $remember->setCheckedValue('yes'); $remember->setUncheckedValue('no'); $remember->setChecked(true); $this->addElement($remember); // submit $submit = new Zend_Dojo_Form_Element_SubmitButton('submit'); $submit->setLabel(__('Submit')); $this->addElement($submit); }
public function init() { $this->setName('frmLogin'); $this->setMethod('post'); $username = new Zend_Dojo_Form_Element_ValidationTextBox('txtUserName'); $username->setLabel('Usuario: ')->setRequired(true)->setRegExp("[\\w\\d]*"); $password = new Zend_Dojo_Form_Element_PasswordTextBox('txtPassword'); $password->setLabel('Senha: ')->setRequired(true)->setRegExp("[\\d\\w]*"); $submit = new Zend_Dojo_Form_Element_SubmitButton('Acessar'); $this->addElements(array($username, $password, $submit)); }
public function init() { /* Form Elements & Other Definitions Here ... */ $user_name_login = new Zend_Dojo_Form_Element_ValidationTextBox('txt_user_name'); $user_name_login->setLabel('ឈ្មោះអ្នកប្រើប្រាស់')->setRequired(true); $password_login = new Zend_Dojo_Form_Element_PasswordTextBox('txt_password'); $password_login->setLabel('ពាក្យសំងាត់')->setRequired(true); $submit_login = new Zend_Dojo_Form_Element_SubmitButton('submit_login'); $submit_login->setLabel('ចាប់ផ្តើម'); $clear_login = new Zend_Dojo_Form_Element_Button('clear_login'); $clear_login->setLabel("សារដើម"); $this->addElements(array($user_name_login, $password_login, $submit_login, $clear_login)); }
public function init() { // Identidade do Usuário $identidade = new Zend_Dojo_Form_Element_TextBox('identidade'); $identidade->setLabel('Nome do Usuário')->setRequired(true); $this->addElement($identidade); // Credenciais $credencial = new Zend_Dojo_Form_Element_PasswordTextBox('credencial'); $credencial->setLabel('Senha'); $this->addElement($credencial); // Botão de Envio $submit = new Zend_Dojo_Form_Element_SubmitButton('submit'); $submit->setLabel('Entrar')->setIgnore(true); $this->addElement($submit); }
public function init() { // Identidade $identidade = new Zend_Dojo_Form_Element_TextBox('identidade'); $identidade->setLabel('Usuário')->setDescription('Nome do Usuário para Acessar o Sistema'); $this->addElement($identidade); // Credenciais $credencial = new Zend_Dojo_Form_Element_PasswordTextBox('credencial'); $credencial->setLabel('Senha')->setDescription('Credenciais para Autenticação')->addFilter(new Zend_Filter_Null()); $this->addElement($credencial); // Autor $autor = new Application_Form_Autor(); $autor->removeElement('submit'); $this->addSubForm($autor, 'autor'); // Botão de Envio $submit = new Local_Form_Element_SubmitButton('submit'); $this->addElement($submit); }
public function __construct() { parent::__construct(); $router = new Shared_Controller_Router(); $this->setAction($router->assemble(array(), 'register')); $this->setMethod('post'); // email $email = new Zend_Dojo_Form_Element_TextBox('email'); $email->setLabel(__('Email')); $email->setRequired(true); $this->addElement($email); // password $password = new Zend_Dojo_Form_Element_PasswordTextBox('password'); $password->setLabel(__('Password')); $password->setRequired(true); $this->addElement($password); // submit $submit = new Zend_Dojo_Form_Element_SubmitButton('submit'); $submit->setLabel(__('Submit')); $this->addElement($submit); }
public function init() { //логин пользователя $txtLog = new Zend_Dojo_Form_Element_ValidationTextBox(array('name' => 'username', 'label' => 'Имя пользователя (логин) (*)', 'required' => true, 'trim' => true, 'regExp' => AuthModel::LOGIN_PARTIAL_REGEX, 'invalidMessage' => 'Допускаются символы латинского алфавита, знак подчёркивания и минус. Длина от 3 до 32х символов')); //правильный валидатор имени пользователя в соответсвии с требованиями. $txtLog->addValidator('regex', true, array(AuthModel::LOGIN_REGEX)); $txtPwd = new Zend_Dojo_Form_Element_PasswordTextBox(array('name' => 'password', 'label' => 'Пароль (проверьте текущую раскладку клавиатуры и состояние клавиши CapsLock) (*)', 'required' => true, 'regExp' => AuthModel::PWD_PARTIAL_REGEX, 'invalidMessage' => 'Пароль должен быть не менее ' . AuthModel::PWD_MIN_LEN . ' знаков и не более ' . AuthModel::PWD_MAX_LEN . ' знаков длиной')); $txtPwd->addFilter('StringTrim'); $txtPwd2 = new Zend_Dojo_Form_Element_PasswordTextBox(array('name' => 'password2', 'label' => 'Повторите пароль (*)', 'required' => true, 'regExp' => AuthModel::PWD_PARTIAL_REGEX, 'invalidMessage' => 'Повторно введённый пароль не совпадает с исходным!')); $txtPwd2->addFilter('StringTrim'); $txtEmail = new Zend_Dojo_Form_Element_ValidationTextBox(array('name' => 'email', 'label' => 'Электронная почта (*). Используется только внутри сайта для получения уведомлений о новых комментариях, смены пароля и прочих служебных действий. Третьим лицам не передаётся.', 'required' => true, 'trim' => true, 'regExp' => AuthModel::EMAIL_PARTIAL_REGEX, 'invalidMessage' => 'Вероятно, введённая строка не явлется адресом почты. Укажите правильный адрес')); $txtEmail->addFilter('StringToLower'); $txtEmail->addValidator('StringLength', true, array(0, AuthModel::EMAIL_MAX_LEN))->addValidator('EmailAddress', true); $bShowEmail = new Zend_Dojo_Form_Element_CheckBox(array('name' => 'bshowemail', 'label' => 'Показывать другим пользователям Ваш email?', 'checkedValue' => '1', 'uncheckedValue' => '0', 'checked' => false)); $bShowEmail->addValidator('regex', true, array('/^0|1$/')); $txtName = new Zend_Dojo_Form_Element_ValidationTextBox(array('name' => 'name', 'label' => 'Ваше имя', 'trim' => true, 'regExp' => '^.{0,' . AuthModel::NAME_MAX_LEN . '}$', 'invalidMessage' => 'Длина поля ограничена ' . AuthModel::NAME_MAX_LEN . ' символами')); $txtName->addValidators(array(array(new Zend_Validate_StringLength(0, AuthModel::NAME_MAX_LEN), true))); //страна $txtCountry = new Zend_Dojo_Form_Element_ValidationTextBox(array('name' => 'country', 'label' => 'Страна', 'trim' => true, 'regExp' => '^.{0,' . AuthModel::VAR_FIELD_MAX_LEN . '}$', 'invalidMessage' => 'Длина поля ограничена ' . AuthModel::VAR_FIELD_MAX_LEN . ' символами')); $varFieldLengthVld = array(new Zend_Validate_StringLength(0, AuthModel::VAR_FIELD_MAX_LEN), true); $txtCountry->addValidators(array($varFieldLengthVld)); $txtCity = new Zend_Dojo_Form_Element_ValidationTextBox(array('name' => 'city', 'label' => 'Город', 'trim' => true, 'regExp' => '^.{0,' . AuthModel::VAR_FIELD_MAX_LEN . '}$', 'invalidMessage' => 'Длина поля ограничена ' . AuthModel::VAR_FIELD_MAX_LEN . ' символами')); $txtCity->addValidators(array($varFieldLengthVld)); $birthday = new Zend_Dojo_Form_Element_DateTextBox(array('name' => 'birthday', 'label' => 'Ваш день рождения', 'invalidMessage' => 'Указана неверная дата', 'formatLength' => 'long')); $birthday->addValidator('Date', true); $cIcq = new Zend_Dojo_Form_Element_ValidationTextBox(array('name' => 'cicq', 'label' => 'Номер ICQ', 'trim' => true, 'regExp' => '^\\d{0,' . AuthModel::ICQNUM_MAX_CHARS . '}$', 'invalidMessage' => 'Номер ICQ должен являться числом')); $cIcq->addValidators(array(array('StringLength', true, array(0, AuthModel::ICQNUM_MAX_CHARS)), array('Digits', true))); $cSkype = new Zend_Dojo_Form_Element_TextBox(array('name' => 'cskype', 'label' => 'Skype', 'trim' => true)); $cSkype->addValidators(array($varFieldLengthVld)); $captcha = new Zend_Form_Element_Captcha('turingtest', array('label' => "Captcha", 'captcha' => 'ReCaptcha', 'captchaOptions' => array('privKey' => '6Lf9xQMAAAAAAGt9yhFNmsuemMpAzefPc0qDrxmo', 'pubKey' => '6Lf9xQMAAAAAAN9DCeBc_x8ZAK7hKtQrozTF6KAa'))); //делаем язык. через жопу $captcha->getCaptcha()->getService()->setOption('lang', 'ru'); $btnSubmit = new Zend_Dojo_Form_Element_SubmitButton(array('name' => 'register', 'label' => 'Register!')); //добавляем onSubmit, потому что требуется там ручками обрабатывать значение чекбокса - оно почему-то не меняется. //задаём проверочную функцию $this->setAttrib('onsubmit', "dojo.byId('bshowemail').value = dijit.byId('bshowemail').attr('checked') ? '1' : '0'; return true;"); $this->setAttrib('id', 'regForm'); $this->addElements(array($txtLog, $txtPwd, $txtPwd2, $txtEmail, $bShowEmail, $txtName, $txtCountry, $txtCity, $birthday, $cIcq, $cSkype, $captcha, $btnSubmit)); }