public function init() { $schemeSelect = new Zend_Form_Element_Select(array('name' => 'schemeSelect', 'required' => TRUE, 'belongsTo' => $this->getName(), 'style' => 'width:80px;margin-right:2px;padding:2px 0;', 'multiOptions' => array('http://' => 'http://', 'https://' => 'https://'))); $this->setSchemeSelect($schemeSelect); $hostText = new Zend_Form_Element_Text(array('name' => 'hostText', 'belongsTo' => $this->getName(), 'class' => 'form-control', 'placeholder' => Zend_Registry::get('Zend_Translate')->_('adres URL'), 'validators' => array(array('stringLength', true, array('min' => 5, 'max' => 185)), array(new My_Validate_UrlHost(), true)), 'filters' => array(array('strReplace', array(array('search' => array('http://', 'https://'), 'replace' => ''))), array('stringTrim', array('/'))))); $hostText->addPrefixPath('My_Filter', 'My/Filter/', 'filter'); $this->setHostText($hostText); }
public function init() { /* $email = $this->addElement('text', 'email', array( 'filters' => array('StringTrim', 'StringToLower'), 'validators' => array( 'EmailAddress', ), 'required' => true, 'label' => $this->translate->_("Email"), 'decorators' => $this->elementDecorators, 'description'=>"mustbe lower..." )); */ $email = new Zend_Form_Element_Text("email"); $email->setLabel('Email'); $email->setDecorators($this->elementDecorators); $email->addValidator("EmailAddress"); $email->addValidator("ExistUser", false, array("email")); $email->addPrefixPath('VC_Validate', 'VC/Validate/', 'validate'); $this->addElements(array($email)); /*$username = $this->addElement('text', 'username', array( 'filters' => array('StringTrim', 'StringToLower'), 'validators' => array( 'Alpha', array('StringLength', false, array(3, 20)), ), 'required' => true, 'label' => $this->translate->_("Username"), 'decorators' => $this->elementDecorators, )); */ $token = $this->addElement('hidden', 'token', array('disableLoadDefaultDecorators' => true)); $password = $this->addElement('password', 'password', array('filters' => array('StringTrim'), 'validators' => array(array('StringLength', false, array(6, 20))), 'required' => true, 'label' => $this->translate->_("Password"), 'decorators' => $this->elementDecorators)); /* $re_password = $this->addElement('password', 'password_confirm', array( 'filters' => array('StringTrim'), 'validators' => array( array('SL_ValidatorMatch', false, array("password")), ), 'required' => true, 'label' => $this->translate->_("Confirm password"), 'decorators' => $this->elementDecorators, )); */ $re_password = new Zend_Form_Element_Password("password_confirm"); $re_password->setLabel('Confirm Password'); $re_password->setDecorators($this->elementDecorators); $re_password->addValidator("PasswordConfirmation", false, array("password")); $re_password->addPrefixPath('VC_Validate', 'VC/Validate/', 'validate'); $this->addElements(array($re_password)); $username = $this->addElement('text', 'fullname', array('filters' => array('StringTrim'), 'validators' => array(array('StringLength', false, array(3, 70))), 'required' => true, 'label' => $this->translate->_("Full name"), 'decorators' => $this->elementDecorators)); // Add a captcha $this->addElement('captcha', 'captcha', array('label' => $this->translate->_("Please enter the 5 letters displayed below:"), 'required' => true, 'captcha' => array('captcha' => 'Figlet', 'wordLen' => 5, 'timeout' => 300))); $login = $this->addElement('submit', 'login', array('required' => false, 'ignore' => true, 'label' => $this->translate->_("Register"), 'decorators' => $this->buttonDecorators)); }