private function _buildElements() { $submit = new Zend_Form_Element_Submit($this->_name . "_Submit"); $submit->setLabel("Modifier"); $submit->addDecorators(array("br" => new Zend_Form_Decorator_HtmlTag(array("tag" => "br", "noAttribs" => true)), "hr" => new Zend_Form_Decorator_HtmlTag(array("tag" => "hr", "noAttribs" => true)))); return array($submit); }
public function init() { $this->clearDecorators(); $this->addElementPrefixPath('Pas_Validate', 'Pas/Validate/', 'validate'); $this->addPrefixPath('Pas_Form_Element', 'Pas/Form/Element/', 'element'); $decorators = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'append', 'class' => 'error', 'tag' => 'li')), array('Label', array('separator' => ' ', 'requiredSuffix' => ' *', 'class' => 'leftalign')), array('HtmlTag', array('tag' => 'li'))); $oldpassword = new Zend_Form_Element_Password('oldpassword'); $oldpassword->setLabel('Your old password: '******'RightPassword')->addFilters(array('StripTags', 'StringTrim')); $oldpassword->setDecorators($decorators); $password = new Zend_Form_Element_Password("password"); $password->setLabel("New password:"******"NotEmpty")->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->setDecorators($decorators)->addValidator('IdenticalField', false, array('password2', ' confirm password field')); // identical field validator with custom messages $hash = new Zend_Form_Element_Hash('csrf'); $hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(60); $this->addElement($hash); $password2 = new Zend_Form_Element_Password("password2"); $password2->setLabel("Confirm password:"******"NotEmpty")->addFilters(array('StripTags', 'StringTrim'))->setRequired(true)->setDecorators($decorators); $submit = new Zend_Form_Element_Submit('submit'); $submit->clearDecorators(); $submit->addDecorators(array(array('ViewHelper'), array('HtmlTag', array('tag' => 'div', 'class' => 'submit')))); $submit->setAttrib('class', 'large')->setLabel('Change password'); $this->addElement($submit); $this->addElements(array($oldpassword, $password, $password2, $submit)); $this->addDisplayGroup(array('oldpassword', 'password', 'password2'), 'userdetails'); $this->addDecorator('FormElements')->addDecorator(array('ListWrapper' => 'HtmlTag'), array('tag' => 'div'))->addDecorator('FieldSet')->addDecorator('Form'); $this->userdetails->removeDecorator('DtDdWrapper'); $this->userdetails->removeDecorator('FieldSet'); $this->userdetails->addDecorator(array('DtDdWrapper' => 'HtmlTag'), array('tag' => 'ul')); $this->addDisplayGroup(array('submit'), 'submit'); $this->setLegend('Edit account details: '); }
public function init() { parent::init('Modelo'); $this->setName('FormModelo')->setMethod('post')->setAttrib('id', 'FormModelo')->clearDecorators()->addDecorator('FormElements')->addDecorator('HtmlTag', array('tag' => 'div'))->addDecorator('Form')->setElementDecorators(array(array('ViewHelper'), array('Errors'), array('Label', array('tag' => 'div')), array('HtmlTag', array('tag' => 'div')))); $guardar = new Zend_Form_Element_Submit('guardar', array('label' => 'Guardar')); $guardar->addDecorators(array(array('HtmlTag', array('tag' => 'div')))); $this->addElement($guardar); }
public function init() { $required = true; $roles = new Roles(); $role_options = $roles->getRoles(); $inst = new Institutions(); $inst_options = $inst->getInsts(); $this->setAction($this->_actionUrl)->setMethod('post')->setAttrib('id', 'accountform'); $this->clearDecorators(); $this->addElementPrefixPath('Pas_Validate', 'Pas/Validate/', 'validate'); $this->addPrefixPath('Pas_Form_Element', 'Pas/Form/Element/', 'element'); $decorators = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'prepend', 'class' => 'error', 'tag' => 'li')), array('Label', array('separator' => ' ', 'requiredSuffix' => ' *', 'class' => 'leftalign')), array('HtmlTag', array('tag' => 'li'))); $username = $this->addElement('text', 'username', array('label' => 'Username: '******'StripTags', 'StringTrim'))->setRequired(true); $firstName = $this->addElement('text', 'first_name', array('label' => 'First Name', 'size' => '30'))->first_name; $firstName->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Alnum', false, array('allowWhiteSpace' => true))->addErrorMessage('You must enter a firstname'); $firstName->setDecorators($decorators); $lastName = $this->addElement('text', 'last_name', array('label' => 'Last Name', 'size' => '30'))->last_name; $lastName->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Alnum', false, array('allowWhiteSpace' => true))->addErrorMessage('You must enter a surname'); $lastName->setDecorators($decorators); $fullname = $this->addElement('text', 'fullname', array('label' => 'Preferred Name: ', 'size' => '30'))->fullname; $fullname->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Alnum', false, array('allowWhiteSpace' => true))->addErrorMessage('You must enter your preferred name'); $fullname->setDecorators($decorators); $email = $this->addElement('text', 'email', array('label' => 'Email Address', 'size' => '30'))->email; $email->addValidator('EmailAddress')->addFilters(array('StripTags', 'StringTrim', 'StringToLower'))->setRequired(true)->addErrorMessage('Please enter a valid address!'); $email->setDecorators($decorators); $password = $this->addElement('password', 'password', array('label' => 'Change password: '******'size' => '30'))->password; $password->setRequired(false); $password->setDecorators($decorators); $institution = $this->addElement('select', 'institution', array('label' => 'Recording institution: '))->institution; $institution->setDecorators($decorators); $institution->addMultiOptions(array(NULL => NULL, 'Choose institution' => $inst_options)); $role = $this->addElement('select', 'role', array('label' => 'Site role: '))->role; $role->setDecorators($decorators); $role->addMultiOptions(array(NULL => NULL, 'Choose role' => $role_options)); $person = $this->addElement('text', 'person', array('label' => 'Personal details attached: '))->person; $person->setDecorators($decorators); $peopleID = $this->addElement('hidden', 'peopleID', array())->peopleID; $peopleID->setDecorators($decorators); $submit = new Zend_Form_Element_Submit('submit'); $submit->clearDecorators(); $submit->addDecorators(array(array('ViewHelper'), array('HtmlTag', array('tag' => 'div', 'class' => 'submit')))); $submit->setAttrib('class', 'large'); $this->addElement($submit); $hash = new Zend_Form_Element_Hash('csrf'); $hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(60); $this->addElement($hash); $this->addDisplayGroup(array('username', 'first_name', 'last_name', 'fullname', 'email', 'institution', 'role', 'password', 'person', 'peopleID'), 'userdetails'); $this->addDecorator('FormElements')->addDecorator(array('ListWrapper' => 'HtmlTag'), array('tag' => 'div'))->addDecorator('FieldSet')->addDecorator('Form'); $this->userdetails->removeDecorator('DtDdWrapper'); $this->userdetails->removeDecorator('FieldSet'); $this->userdetails->addDecorator(array('DtDdWrapper' => 'HtmlTag'), array('tag' => 'ul')); $this->addDisplayGroup(array('submit'), 'submit'); $this->setLegend('Edit account details: '); }
public function init() { $required = true; $this->setAction($this->_actionUrl)->setMethod('post')->setAttrib('id', 'accountform'); $this->clearDecorators(); $this->addElementPrefixPath('Pas_Validate', 'Pas/Validate/', 'validate'); $this->addPrefixPath('Pas_Form_Element', 'Pas/Form/Element/', 'element'); $decorators = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'prepend', 'class' => 'error', 'tag' => 'li')), array('Label', array('separator' => ' ', 'requiredSuffix' => ' *', 'class' => 'leftalign')), array('HtmlTag', array('tag' => 'li'))); $username = $this->addElement('text', 'username', array('label' => 'Username: '******'StripTags')->addFilter('StringTrim')->addValidator('StringLength', true, array('max' => 40))->setRequired(true); $username->getValidator('StringLength')->setMessage('Username is too long'); $password = $this->addElement('password', 'password', array('label' => 'Password'))->password; $password->addValidator('StringLength', true, array(6))->addValidator('Regex', true, array('/^(?=.*\\d)(?=.*[a-zA-Z]).{6,}$/'))->setRequired(true)->addErrorMessage('Please enter a valid password!'); $password->getValidator('StringLength')->setMessage('Password is too short'); $password->getValidator('Regex')->setMessage('Password does not contain letters and numbers'); $password->setDecorators($decorators); $firstName = $this->addElement('text', 'first_name', array('label' => 'First Name', 'size' => '30'))->first_name; $firstName->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addErrorMessage('You must enter a firstname'); $firstName->setDecorators($decorators); $lastName = $this->addElement('text', 'last_name', array('label' => 'Last Name', 'size' => '30'))->last_name; $lastName->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addErrorMessage('You must enter a surname'); $lastName->setDecorators($decorators); $fullname = $this->addElement('text', 'fullname', array('label' => 'Preferred Name: ', 'size' => '30'))->fullname; $fullname->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addErrorMessage('You must enter your preferred name'); $fullname->setDecorators($decorators); $email = $this->addElement('text', 'email', array('label' => 'Email Address', 'size' => '30'))->email; $email->addValidator('EmailAddress')->setRequired(true)->addFilter('StringToLower')->addFilter('StringTrim')->addFilter('StripTags')->addErrorMessage('Please enter a valid address!'); $email->setDecorators($decorators); $institution = $this->addElement('text', 'institution', array('label' => 'Recording institution: ', 'size' => '30'))->institution; $institution->setDecorators($decorators); $researchOutline = $this->addElement('textArea', 'research_outline', array('label' => 'Outline your research', 'rows' => 10, 'cols' => 40))->research_outline; $researchOutline->setRequired(false)->addFilter('HtmlBody')->addFilter('EmptyParagraph'); $reference = $this->addElement('text', 'reference', array('label' => 'Please provide a referee:', 'size' => '40'))->reference; $reference->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim'); $reference->setDecorators($decorators); $referenceEmail = $this->addElement('text', 'reference_email', array('label' => 'Please provide an email address for your referee:', 'size' => '40'))->reference_email; $referenceEmail->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('EmailAddress'); $referenceEmail->setDecorators($decorators); $submit = new Zend_Form_Element_Submit('submit'); $submit->setLabel('Set my account up on Beowulf'); $submit->clearDecorators(); $submit->addDecorators(array(array('ViewHelper'), array('HtmlTag', array('tag' => 'div', 'class' => 'submit')))); $submit->setAttrib('class', 'large'); $this->addElement($submit); $this->addDisplayGroup(array('username', 'password', 'first_name', 'last_name', 'fullname', 'email', 'institution', 'research_outline', 'reference', 'reference_email'), 'userdetails'); $this->addDecorator('FormElements')->addDecorator(array('ListWrapper' => 'HtmlTag'), array('tag' => 'div'))->addDecorator('FieldSet')->addDecorator('Form'); $this->userdetails->removeDecorator('DtDdWrapper'); $this->userdetails->removeDecorator('FieldSet'); $this->userdetails->addDecorator(array('DtDdWrapper' => 'HtmlTag'), array('tag' => 'ul')); $this->addDisplayGroup(array('submit'), 'submit'); $this->setLegend('Edit account details: '); }
public function init() { $this->setName('FormContacto')->setMethod('post')->setAttrib('id', 'FormContacto')->addDecorator('FormElements')->addDecorator('HtmlTag', array('tag' => 'div'))->addDecorator('Form')->setElementDecorators(array(array('ViewHelper'), array('Errors'), array('Label', array('tag' => 'div')), array('HtmlTag', array('tag' => 'div')))); $this->addElement('text', 'nombre', array('label' => 'Nombre :', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validates' => array('alpha'))); $this->addElement('text', 'apellido', array('label' => 'Apellido :', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validates' => array('alpha'))); $this->addElement('text', 'empresa', array('label' => 'Empresa :', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validates' => array('alpha'))); $this->addElement('text', 'cargo', array('label' => 'Cargo :', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validates' => array('alpha'))); $this->addElement('text', 'telefono', array('label' => 'Telefono :', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validates' => array('digits'))); $this->addElement('text', 'email', array('label' => 'E-mail :', 'required' => true, 'filters' => array('StringTrim', 'StripTags'))); $this->getElement('email')->addValidator('EmailAddress'); $this->addElement('text', 'asunto', array('label' => 'Asunto :', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validates' => array('alpha'))); $this->addElement('textarea', 'mensaje', array('label' => 'Mensaje :', 'required' => true, 'attribs' => array('rows' => 5, 'cols' => 54), 'filters' => array('StringTrim', 'StripTags'), 'validates' => array('alpha'))); $guardar = new Zend_Form_Element_Submit('guardar', array('label' => 'Enviar')); $guardar->addDecorators(array(array('HtmlTag', array('tag' => 'div')))); $this->addElement($guardar); }
public function init() { $required = true; $copyrights = new Copyrights(); $copy = $copyrights->getStyles(); $this->setAction($this->_actionUrl)->setMethod('post')->setAttrib('id', 'accountform'); $this->clearDecorators(); $decorators = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'prepend', 'class' => 'error', 'tag' => 'li')), array('Label', array('separator' => ' ', 'requiredSuffix' => ' *', 'class' => 'leftalign')), array('HtmlTag', array('tag' => 'li'))); $username = $this->addElement('text', 'username', array('label' => 'Username:'******'StringTrim', 'StripTags')); $firstName = $this->addElement('text', 'first_name', array('label' => 'First Name: ', 'size' => '30'))->first_name; $firstName->setRequired(true)->addFilters(array('StringTrim', 'StripTags'))->addErrorMessage('You must enter a firstname'); $firstName->setDecorators($decorators); $lastName = $this->addElement('text', 'last_name', array('label' => 'Last Name: ', 'size' => '30'))->last_name; $lastName->setRequired(true)->addFilters(array('StringTrim', 'StripTags'))->addErrorMessage('You must enter a surname'); $lastName->setDecorators($decorators); $fullname = $this->addElement('text', 'fullname', array('label' => 'Preferred Name: ', 'size' => '30'))->fullname; $fullname->setRequired(true)->addFilters(array('StringTrim', 'StripTags'))->addErrorMessage('You must enter your preferred name'); $fullname->setDecorators($decorators); $email = $this->addElement('text', 'email', array('label' => 'Email Address', 'size' => '30'))->email; $email->addValidator('emailAddress')->setRequired(true)->addErrorMessage('Please enter a valid address!')->addFilters(array('StringTrim', 'StripTags', 'StringToLower'))->addValidator('EmailAddress', false, array('mx' => true)); $email->setDecorators($decorators); $password = $this->addElement('password', 'password', array('label' => 'Change password: '******'size' => '30'))->password; $password->addFilters(array('StringTrim', 'StripTags'))->setRequired(false); $password->setDecorators($decorators); $copyright = $this->addElement('select', 'copyright', array('label' => 'Default copyright: '))->copyright; $copyright->setRequired(TRUE); $copyright->addMultiOptions(array(NULL => 'Select a licence holder', 'Valid copyrights' => $copy))->addValidator('InArray', false, array(array_keys($copy)))->setDecorators($decorators); $submit = new Zend_Form_Element_Submit('submit'); $submit->setLabel('Save details'); $submit->clearDecorators(); $submit->addDecorators(array(array('ViewHelper'), array('HtmlTag', array('tag' => 'div', 'class' => 'submit')))); $submit->setAttrib('class', 'large'); $this->addElement($submit); $this->addDisplayGroup(array('username', 'first_name', 'last_name', 'fullname', 'email', 'password', 'copyright'), 'userdetails'); $this->addDecorator('FormElements')->addDecorator(array('ListWrapper' => 'HtmlTag'), array('tag' => 'div'))->addDecorator('FieldSet')->addDecorator('Form'); $this->setLegend('Edit your account and profile details: '); $this->userdetails->removeDecorator('DtDdWrapper'); $this->userdetails->removeDecorator('HtmlTag'); $this->userdetails->removeDecorator('FieldSet'); $this->userdetails->addDecorator(array('DtDdWrapper' => 'HtmlTag'), array('tag' => 'ul')); $this->addDisplayGroup(array('submit'), 'submit'); }
public function __construct($options = null) { parent::__construct($options); $this->setAttrib('accept-charset', 'UTF-8'); $this->clearDecorators(); $decorators = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'prepend', 'class' => 'error', 'tag' => 'li')), array('Label', array('separator' => ' ', 'class' => 'leftalign')), array('HtmlTag', array('tag' => 'div'))); $this->setName('workflow'); $id = new Zend_Form_Element_Hidden('id'); $id->removeDecorator('label'); $wfstage = new Zend_Form_Element_Radio('wfstage'); $wfstage->setRequired(false)->addMultiOptions(array('1' => 'Quarantine', '2' => 'Review', '4' => 'Validation', '3' => 'Published'))->addFilter('StripTags')->addFilter('StringTrim')->setDecorators($decorators); //Submit button $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->clearDecorators(); $submit->addDecorators(array(array('ViewHelper'), array('HtmlTag', array('tag' => 'div', 'class' => 'submit')))); $this->setLegend('Workflow status'); $this->addDecorator('FormElements')->addDecorator('Form')->addDecorator('Fieldset'); $this->addElements(array($id, $wfstage, $submit)); }
private function _addSubmitButton() { // Submit button $submit = new Zend_Form_Element_Submit('submit'); //$submit->setLabel($this->getView()->getCibleText('button_submit')) $submit->setLabel('')->setAttrib('class', 'subscribeButton-' . Zend_Registry::get("languageSuffix"))->removeDecorator('DtDdWrapper'); $submit->addDecorators(array(array(array('row' => 'HtmlTag'), array('tag' => 'dd')))); $this->addElement($submit); // Required fields label $requiredFields = new Zend_Form_Element_Hidden('RequiredFields'); $requiredFields->setLabel('<span class="field_required">*</span> ' . $this->getView()->getCibleText('form_field_required_label')); $this->addElement($requiredFields); }
public function __construct($options = null) { $this->_disabledDefaultActions = true; parent::__construct($options); $baseDir = $this->getView()->baseUrl(); $this->getView()->jQuery()->addJavascriptFile("{$this->getView()->baseUrl()}/js/jquery/jquery.maskedinput-1.2.2.min.js"); $script1 = <<<EOS \$('.phone_format').mask('(999) 999-9999? x99999'); \$('.postalCode_format').mask('a9a 9a9'); \$('.birthDate_format').mask('9999-99-99'); EOS; $this->getView()->headScript()->appendScript($script1); $script2 = <<<EOS function refreshCaptcha(id){ \$.getJSON('{$this->getView()->baseUrl()}/forms/index/captcha-reload', function(data){ \$("dd#dd_captcha img").attr({src : data['url']}); \$("#"+id).attr({value: data['id']}); }); } EOS; $this->getView()->headScript()->appendScript($script2); // name $name = new Zend_Form_Element_Text('name'); $name->setLabel($this->getView()->getCibleText('forms_label_name'))->setAttrib('class', 'stdTextInput'); // enterprise $enterprise = new Zend_Form_Element_Text('prenom'); $enterprise->setLabel($this->getView()->getCibleText('forms_label_surname'))->setAttrib('class', 'stdTextInput'); // email $email = new Zend_Form_Element_Text('email'); $email->setLabel($this->getView()->getClientText('forms_become_partner_label_email'))->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('error_field_required'))))->addValidator('EmailAddress', true, array('messages' => Cible_Translation::getCibleText('validation_message_emailAddressInvalid')))->setRequired(true)->setAttrib('class', 'stdTextInput'); // Commentaires $commentaire = new Zend_Form_Element_Textarea('commentaire'); $commentaire->setLabel($this->getView()->getCibleText('form_label_comments'))->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('class', 'stdTextarea'); $this->addElement($enterprise); $this->addElement($name); $this->addElement($email); $this->addElement($commentaire); // Captcha $captcha = new Zend_Form_Element_Captcha('captcha', array('label' => $this->getView()->getCibleText('newsletter_captcha_label'), 'captcha' => 'Image', 'captchaOptions' => array('captcha' => 'Word', 'wordLen' => 6, 'height' => 50, 'width' => 150, 'timeout' => 600, 'dotNoiseLevel' => 0, 'lineNoiseLevel' => 0, 'font' => Zend_Registry::get('application_path') . "/../{$this->_config->document_root}/captcha/fonts/ARIAL.TTF", 'imgDir' => Zend_Registry::get('application_path') . "/../{$this->_config->document_root}/captcha/tmp", 'imgUrl' => "{$baseDir}/captcha/tmp"))); $captcha->setAttrib('class', 'mediumTextInput'); $captcha->addDecorators(array(array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'id' => 'dd_captcha')))); $this->addElement($captcha); $french = array('badCaptcha' => 'Veuillez saisir la chaîne ci-dessus correctement.'); $english = array('badCaptcha' => 'Captcha value is wrong'); $translate = new Zend_Translate('array', $french, 'fr'); $this->setTranslator($translate); $this->getView()->jQuery()->enable(); // Refresh button $refresh_captcha = new Zend_Form_Element_Button('refresh_captcha'); $refresh_captcha->setLabel($this->getView()->getCibleText('button_captcha_refresh'))->setAttrib('onclick', "refreshCaptcha('captcha[id]')")->setAttrib('class', 'grayish-button')->removeDecorator('Label')->removeDecorator('DtDdWrapper'); $refresh_captcha->addDecorators(array(array(array('row' => 'HtmlTag'), array('tag' => 'dd')))); $this->addElement($refresh_captcha); // Submit button $submit = new Zend_Form_Element_Submit('submit'); $submit->setLabel($this->getView()->getCibleText('button_submit'))->setAttrib('class', 'grayish-button')->removeDecorator('DtDdWrapper'); $submit->addDecorators(array(array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'openOnly' => true)))); $this->addElement($submit); }