public function init() { // init the parent parent::init(); // set the form's method $this->setMethod('post'); $id = new Zend_Form_Element_Hidden('id'); $id->setOptions(array('validators' => array(new Zend_Validate_Regex('/^\\d*$/')))); $this->addElement($id); $firstname = new Zend_Form_Element_Text('firstname'); $firstname->setOptions(array('label' => $this->t('First name'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($firstname); $lastname = new Zend_Form_Element_Text('lastname'); $lastname->setOptions(array('label' => $this->t('Last name'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($lastname); $checkEmailNotJunk = new Zend_Validate_Callback(array($this, 'emailNotJetable')); $uniqueEmailValidator = new Zend_Validate_Db_NoRecordExists(array('table' => 'backoffice_users', 'field' => 'email')); $email = new Zend_Form_Element_Text('email'); $email->setOptions(array('label' => $this->t('Email'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty', $checkEmailNotJunk, $uniqueEmailValidator))); $this->addElement($email); $raisonsocial = new Zend_Form_Element_Text('raison sociale'); $raisonsocial->setOptions(array('label' => $this->t('Raison sociale'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($raisonsocial); // $groupsInArrayValidator = new Zend_Validate_InArray(array_keys(array(1, 2, 3))); // $groupsInArrayValidator->setMessage('Please select at least one group. If you are not sure about which group is better, select "member".'); $status = new Zend_Form_Element_Radio('status'); $status->setOptions(array('label' => $this->t('Status'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'), 'multiOptions' => array('Gérant' => 'Gérant', 'Associé' => 'Associé', 'Freelance patenté' => 'Freelance patenté'))); $this->addElement($status); $submit = new Zend_Form_Element_Submit('submit'); $submit->setOptions(array('label' => $this->t('Save user'), 'required' => true, 'order' => 100)); $this->addElement($submit); }
/** * 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'); $username->setOptions(array('label' => 'Username', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'), 'readonly' => 'readonly')); $this->addElement($username); $email = new Zend_Form_Element_Text('email'); $email->setOptions(array('label' => 'Email address', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty', 'EmailAddress'))); $this->addElement($email); $firstname = new Zend_Form_Element_Text('firstname'); $firstname->setOptions(array('label' => 'First name', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($firstname); $lastname = new Zend_Form_Element_Text('lastname'); $lastname->setOptions(array('label' => 'Last name', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($lastname); $phoneNumber = new Zend_Form_Element_Text('phone_number'); $phoneNumber->setOptions(array('label' => 'Phone number', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($phoneNumber); $submit = new Zend_Form_Element_Submit('submit'); $submit->setOptions(array('label' => 'Save profile', 'required' => true)); $this->addElement($submit); }
public function init() { $nameProject = new Zend_Form_Element_Text('nameProject'); $nameProject->setLabel('nom Projet')->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty'); $dateBegin = new Zend_Form_Element_Text('dateBegin'); $dateBegin->setLabel('à partir de :')->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty'); $dateEnd = new Zend_Form_Element_Text('dateEnd'); $dateEnd->setLabel('jusqu\'à le :')->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty'); $budget = new Zend_Form_Element_Text('budget'); $budget->setLabel('Budget :')->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty'); $localisation = new Zend_Form_Element_Select('localisation'); $localisation->setLabel('Localisation :')->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty'); $cityModel = new City(); $selectReferenceForCity = $cityModel->select()->setIntegrityCheck(false)->from('city'); $localisation->addMultiOption(0, '-'); foreach ($cityModel->fetchAll($selectReferenceForCity) as $row) { $localisation->addMultiOption($row->city_id, $row->city_description); } $domaine = new Zend_Form_Element_Select('domaine'); $domaine->setLabel('Domaine :')->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty'); $reference = new ReferenceValue(); $selectReferenceForDomain = $reference->select()->setIntegrityCheck(false)->from('reference_values')->where('reference_values.reference_Id=5'); $domaine->addMultiOption(0, '-'); foreach ($reference->fetchAll($selectReferenceForDomain) as $row) { $domaine->addMultiOption($row->value_id, $row->name); } $statut = new Zend_Form_Element_Select('statut'); $statut->setLabel('statut :')->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty'); $statut->addMultiOptions(array('1' => 'encours', '2' => 'valide', '3' => 'suspendu')); $submit = new Zend_Form_Element_Submit('submit'); $submit->setOptions(array('label' => $this->t('Filter'), 'required' => true)); $this->setCancelLink(false); $this->addElements(array($nameProject, $dateBegin, $dateEnd, $budget, $localisation, $domaine, $statut, $submit)); }
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() { $this->setMethod('post'); $this->setAction(DOMAIN . 'index/editforgotpassword'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'forgotpassword'); $id = new Zend_Form_Element_Hidden('id'); $username = new Zend_Form_Element_Text('emailaddress'); $username->setAttrib('class', 'email-status'); $username->setLabel('Email Address:'); $username->setRequired(true); $username->addFilter('StripTags'); $username->addFilter('StringTrim'); $username->addValidator('NotEmpty', false, array('messages' => 'Please enter email.')); $username->addValidator('EmailAddress'); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('SEND'); $url = "'default/index/editforgotpassword/format/json'"; $dialogMsg = "''"; $toggleDivId = "''"; $jsFunction = "''"; $submit->setOptions(array('onclick' => "saveDetails({$url},{$dialogMsg},{$toggleDivId},{$jsFunction});")); $this->addElements(array($id, $username, $submit)); $this->setElementDecorators(array('ViewHelper')); }
/** * 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'); //source //alias aliasNotLogged viewIdentifier viewTitle params isStatic //metaKeywords metaDescription $id = new Zend_Form_Element_Hidden('urlAliasId'); $id->setOptions(array('validators' => array(new Zend_Validate_Regex('/^\\d*$/')))); $this->addElement($id); $source = new Zend_Form_Element_Text('source'); $source->setOptions(array('label' => 'Source', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($source); $alias = new Zend_Form_Element_Text('alias'); $alias->setOptions(array('label' => 'Alias', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($alias); $params = new Zend_Form_Element_Text('params'); $params->setOptions(array('value' => '{"module":"frontend","controller":"__","action":"__"}', 'label' => 'Params', 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($params); $isStatic = new Zend_Form_Element_Text('isStatic'); $isStatic->setOptions(array('label' => 'isStatic', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($isStatic); $metaKeywords = new Zend_Form_Element_Text('metaKeywords'); $metaKeywords->setOptions(array('label' => 'metaKeywords', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($metaKeywords); $metaDescription = new Zend_Form_Element_Text('metaDescription'); $metaDescription->setOptions(array('label' => 'metaDescription', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($metaDescription); $submit = new Zend_Form_Element_Submit('submit'); $submit->setOptions(array('label' => $this->t('Save'), 'required' => true)); $this->addElement($submit); }
/** * 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'); $idMember = App_Utilities::getIdMember(); $member_id = new Zend_Form_Element_Hidden('member_id'); $member_id->addFilter('Int')->setValue($idMember); $this->addElement($member_id); $start_date = new Zend_Form_Element_Text('start_date'); $start_date->setOptions(array('label' => $this->t('Start date'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($start_date); $end_date = new Zend_Form_Element_Text('end_date'); $end_date->setOptions(array('label' => $this->t('End Date'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($end_date); $is_posted = new Zend_Form_Element_Checkbox('is_posted'); $this->addElement($is_posted); $companyName = new Zend_Form_Element_Text('name'); $companyName->setOptions(array('label' => $this->t('Company'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($companyName); $function = new Zend_Form_Element_Text('function'); $function->setOptions(array('label' => $this->t('function'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($function); $mission = new Zend_Form_Element_Textarea('mission'); $mission->setOptions(array('label' => $this->t('mission'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($mission); $city_name = new Zend_Form_Element_Text('city_name'); $city_name->setOptions(array('label' => $this->t('city'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($city_name); $submit = new Zend_Form_Element_Submit('submit'); $submit->setOptions(array('label' => $this->t('Save'), 'required' => true)); $this->addElement($submit); }
/** * * @param mixed $options * * @return void * */ public function __construct($options = null) { parent::__construct($options = null); $this->setAction('/default/wished-userbook/search-list')->setMethod('get'); $defaultValue = __("Nom, prénom, email...", "s1b"); // Email element $searchTermElement = new \Zend_Form_Element_Text("wishedListSearchTerm"); $searchTermElement->class = "input-item"; $searchTermElement->setValue($defaultValue); $searchTermElement->setAttrib("auto-restore", ""); $searchTermElement->addValidator("stringlength", false, array("min" => 3, "messages" => array(\Zend_Validate_StringLength::TOO_SHORT => __("'%value%' doit faire plus de %min% caractères de long", "s1b")))); $this->removeAllDecorators($searchTermElement); // Submit button element $searchButtonElement = new \Zend_Form_Element_Submit("search"); $searchButtonElement->setOptions(array('label' => __("Rechercher", "s1b"))); $searchButtonElement->class = "button bt-red-m"; $this->removeAllDecorators($searchButtonElement); // Email default label element $defaultLabelHidden = new \Zend_Form_Element_Hidden("emailDefaultLabel"); $defaultLabelHidden->setValue($defaultValue); $defaultLabelHidden->class = "default-value"; $this->removeAllDecorators($defaultLabelHidden); $this->addElements(array($searchTermElement, $searchButtonElement, $defaultLabelHidden)); $this->removeDecorator("HtmlTag"); }
/** * 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'); $user = Zend_Auth::getInstance()->getIdentity(); $oldPasswordValidator = new App_Validate_PasswordExists(array('table' => 'backoffice_users', 'field' => 'password', 'treatment' => 'BackofficeUser::hashPassword', 'userPkValue' => $user->id)); $complexityValidator = new Zend_Validate_Regex('/^(?=.*\\d)(?=.*[a-z|A-Z]).{7,}$/'); $complexityValidator->setMessage('The selected password does not meet the required complexity requirements'); $stringLengthValidator = new Zend_Validate_StringLength(); $stringLengthValidator->setMin(7); $stringLengthValidator->setMessage('Your password must be at least 7 characters long'); $passwordHistoryValidator = new App_Validate_NoPasswordExists(array('table' => 'password_log', 'field' => 'password', 'treatment' => 'BackofficeUser::hashPassword', 'userPkField' => 'user_id', 'userPkValue' => $user->id)); $oldPassword = new Zend_Form_Element_Password('old_password'); $oldPassword->setOptions(array('label' => $this->t('Old password'), 'required' => TRUE, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty', $oldPasswordValidator))); $this->addElement($oldPassword); $password = new Zend_Form_Element_Password('password'); $password->setOptions(array('label' => $this->t('New password'), 'required' => TRUE, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty', $stringLengthValidator, $complexityValidator, $passwordHistoryValidator))); $this->addElement($password); $sameAsValidator = new App_Validate_SameAs($password); $sameAsValidator->setMessage('The two passwords do not coincide.', App_Validate_SameAs::NOT_THE_SAME); $retypeNewPassword = new Zend_Form_Element_Password('retype_new_password'); $retypeNewPassword->setOptions(array('label' => $this->t('Retype new password'), 'required' => TRUE, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty', $sameAsValidator))); $this->addElement($retypeNewPassword); $submit = new Zend_Form_Element_Submit('submit'); $submit->setOptions(array('label' => $this->t('Save password'), 'required' => TRUE)); $this->addElement($submit); }
/** * 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(); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'roles'); $id = new Zend_Form_Element_Hidden('id'); $rolename = new Zend_Form_Element_Text('rolename'); $rolename->setAttrib('maxLength', 50); $rolename->setAttrib('title', 'Role name'); $rolename->addFilter(new Zend_Filter_StringTrim()); $rolename->setRequired(true); $rolename->addValidator('NotEmpty', false, array('messages' => 'Please enter role name.')); $rolename->addValidator("regex", true, array('pattern' => '/^[a-zA-Z0-9 ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid role name.'))); $rolename->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_roles', 'field' => 'rolename', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive!=0'))); $rolename->getValidator('Db_NoRecordExists')->setMessage('Role name already exists.'); $rolename->addValidators(array(array('StringLength', false, array('min' => 3, 'max' => 50, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Role name must contain at most %max% characters.', Zend_Validate_StringLength::TOO_SHORT => 'Role name must contain at least %min% characters.'))))); $roletype = new Zend_Form_Element_Text('roletype'); $roletype->setRequired(true); $roletype->setAttrib('maxLength', 25); $roletype->setAttrib('title', 'Role type'); $roletype->addFilter(new Zend_Filter_StringTrim()); $roletype->addValidator('NotEmpty', false, array('messages' => 'Please enter role type.')); $roletype->addValidator("regex", true, array('pattern' => '/^[a-zA-Z]+?$/', 'messages' => array('regexNotMatch' => 'Please enter only alphabets.'))); $roletype->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_roles', 'field' => 'roletype', 'exclude' => 'id != "' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive != 0'))); $roletype->getValidator('Db_NoRecordExists')->setMessage('Role type already exists.'); $roletype->addValidators(array(array('StringLength', false, array('min' => 3, 'max' => 25, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Role type must contain at most %max% characters.', Zend_Validate_StringLength::TOO_SHORT => 'Role type must contain at least %min% characters.'))))); $roledescription = new Zend_Form_Element_Textarea('roledescription'); $roledescription->setAttrib('rows', 10); $roledescription->setAttrib('cols', 50); $roledescription->setAttrib('maxlength', '100'); $roledescription->setAttrib('title', 'Role description'); $levelid = new Zend_Form_Element_Hidden('levelid'); $levelid->addFilter(new Zend_Filter_StringTrim()); $levelid->setRequired(true); $levelid->addValidator('NotEmpty', false, array('messages' => 'Please select level.')); $istimeActive = Zend_Controller_Front::getInstance()->getRequest()->getParam('istimeactive'); $prev_cnt = new Zend_Form_Element_Hidden('prev_cnt'); $prev_cnt->setRequired(true); if ($istimeActive) { $prev_cnt->addValidator('NotEmpty', false, array('messages' => 'Please select privileges other than time management.')); } else { $prev_cnt->addValidator('NotEmpty', false, array('messages' => 'Please select privileges.')); } $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $url = "'roles/saveupdate/format/json'"; $dialogMsg = "''"; $toggleDivId = "''"; $jsFunction = "'redirecttocontroller(\\'roles\\');'"; $submit->setOptions(array('onclick' => "saveDetails({$url},{$dialogMsg},{$toggleDivId},{$jsFunction});")); $this->addElements(array($id, $rolename, $roletype, $roledescription, $levelid, $submit, $prev_cnt)); $this->setElementDecorators(array('ViewHelper')); }
public function init() { // if (!$this->hasTranslator()) { // $this->setTranslator(Zend_Registry::get('Zend_Translate')); // } $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)); $login = new Zend_Form_Element_Submit('login'); $login->setOptions(array('label' => 'Login')); $this->setName('login-form')->setMethod(Zend_Form::METHOD_POST)->setEnctype(Zend_Form::ENCTYPE_URLENCODED)->addElements(array($username, $password, $login))->setDecorators(array('FormElements', 'Errors', array('HtmlTag', array('tag' => 'table', 'cellpadding' => '3')), 'Form')); }
/** * 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'); $id = new Zend_Form_Element_Hidden('id'); $id->setOptions(array('required' => true, 'validators' => array(new Zend_Validate_Regex('/^\\d*$/')))); $this->addElement($id); $submit = new Zend_Form_Element_Submit('submit'); $submit->setOptions(array('label' => 'Yes, delete it', 'required' => true)); $this->addElement($submit); }
/** * 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'); // $username->setOptions( // array( // 'label' => $this->t('Username'), // 'required' => true, // 'filters' => array( // 'StringTrim', // 'StripTags', // ), // 'validators' => array( // 'NotEmpty', // ), // 'readonly' => 'readonly', // ) // ); // $this->addElement($username); $idMember = App_Utilities::getIdMember(); $member_id = new Zend_Form_Element_Hidden('member_id'); $member_id->addFilter('Int')->setValue($idMember); $this->addElement($member_id); $firstname = new Zend_Form_Element_Text('first_name'); $firstname->setOptions(array('label' => $this->t('First name'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($firstname); $lastname = new Zend_Form_Element_Text('last_name'); $lastname->setOptions(array('label' => $this->t('Last name'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($lastname); $email = new Zend_Form_Element_Text('email'); $email->setOptions(array('label' => $this->t('Email address'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty', 'EmailAddress'))); $this->addElement($email); $birthdate = new Zend_Form_Element_Text('birthdate'); $birthdate->setOptions(array('label' => $this->t('birthdate'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($birthdate); $city = new Zend_Form_Element_Text('name'); $city->setOptions(array('label' => $this->t('city'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($city); $phoneNumber = new Zend_Form_Element_Text('phone_number'); $phoneNumber->setOptions(array('label' => $this->t('Phone number'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($phoneNumber); $submit = new Zend_Form_Element_Submit('submit'); $submit->setOptions(array('label' => $this->t('Save profile'), 'required' => true)); $this->addElement($submit); }
/** * 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'); $username->setOptions(array('label' => 'Username', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($username); $password = new Zend_Form_Element_Password('password'); $password->setOptions(array('label' => 'Password', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($password); $submit = new Zend_Form_Element_Submit('submit'); $submit->setOptions(array('label' => 'Log in →', 'required' => true)); $this->addElement($submit); }
public function init() { // get parent form parent::init(); $this->removeElement('UserID'); $this->removeElement('UserName'); $this->removeElement('FirstName'); $this->removeElement('LastName'); $this->removeElement('Email'); $this->removeElement('register'); $submit = new Zend_Form_Element_Submit('save'); $submit->setLabel('Save'); $submit->setOptions(array('class' => 'submit')); $this->addElement($submit); // set form action (set to false for current URL) $this->setAction('/user/account/password'); }
/** * Overrides init() in Zend_Form * * @access public * @return void */ public function init() { // init the parent parent::init(); // set the form's method // set the form's method $this->setAction('/contact/listmycontact')->setMethod('post'); $firstName = new Zend_Form_Element_Text('search'); $firstName->setOptions(array('value' => $this->t('Search'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($firstName); $status = new Zend_Form_Element_Radio('status'); $status->setOptions(array('label' => $this->t('Type'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'), 'multiOptions' => array('Reseau' => 'Réseau', 'Mycontact' => 'Mes Contacts'))); $this->addElement($status); $submit = new Zend_Form_Element_Submit('submit_search'); $submit->setOptions(array('label' => $this->t('Search'), 'required' => true)); $this->addElement($submit); }
/** * 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'); $idMember = App_Utilities::getIdMember(); $member_id = new Zend_Form_Element_Hidden('member_id'); $member_id->addFilter('Int')->setValue($idMember); $this->addElement($member_id); $skills = new Zend_Form_Element_Text('name'); $skills->setOptions(array('label' => $this->t('Skills'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($skills); $submit = new Zend_Form_Element_Submit('submit'); $submit->setOptions(array('label' => $this->t('Save'), 'required' => true)); $this->addElement($submit); }
/** * 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'); $raisonsocial = new Zend_Form_Element_Text('raison sociale'); $raisonsocial->setOptions(array('label' => $this->t('Raison sociale'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($raisonsocial); // $groupsInArrayValidator = new Zend_Validate_InArray(array_keys(array(1, 2, 3))); // $groupsInArrayValidator->setMessage('Please select at least one group. If you are not sure about which group is better, select "member".'); $status = new Zend_Form_Element_Radio('status'); $status->setOptions(array('label' => $this->t('Status'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'), 'multiOptions' => array('Gérant' => 'Gérant', 'Associé' => 'Associé', 'Freelance patenté' => 'Freelance patenté'))); $this->addElement($status); $submit = new Zend_Form_Element_Submit('submit'); $submit->setOptions(array('label' => $this->t('Save user'), 'required' => true, 'order' => 100)); $this->addElement($submit); }
/** * 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'); $idMember = App_Utilities::getIdMember(); $member_id = new Zend_Form_Element_Hidden('member_id'); $member_id->addFilter('Int')->setValue($idMember); $this->addElement($member_id); $file = new Zend_Form_Element_File('image_url'); $file->setLabel('image')->setAttrib('enctype', 'multipart/form-data')->setDestination(APPLICATION_PATH . '/../public/frontend/images/profil/')->setRequired(false); $this->addElement($file); $profil_description = new Zend_Form_Element_Textarea('profil_description'); $profil_description->setOptions(array('label' => $this->t('description'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($profil_description); $submit = new Zend_Form_Element_Submit('submit'); $submit->setOptions(array('label' => $this->t('Save'), 'required' => true)); $this->addElement($submit); }
/** * 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'); $nameCompany = new Zend_Form_Element_Text('name'); $nameCompany->setOptions(array('label' => $this->t('Raison social'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($nameCompany); $synopsis = new Zend_Form_Element_Textarea('synopsis'); $synopsis->setOptions(array('label' => $this->t('synopsis'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($synopsis); $file = new Zend_Form_Element_File('logo'); $file->setLabel('image')->setAttrib('enctype', 'multipart/form-data')->setDestination(APPLICATION_PATH . '/../public/frontend/images/logo/')->setRequired(false); $this->addElement($file); $rc = new Zend_Form_Element_Text('rc'); $rc->setOptions(array('label' => $this->t('rc'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($rc); $patente = new Zend_Form_Element_Text('patente'); $patente->setOptions(array('label' => $this->t('patente'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($patente); $createDate = new Zend_Form_Element_Text('create_date'); $createDate->setOptions(array('label' => $this->t('create_date'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($createDate); $tel = new Zend_Form_Element_Text('tel'); $tel->setOptions(array('label' => $this->t('tel'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($tel); $fax = new Zend_Form_Element_Text('fax'); $fax->setOptions(array('label' => $this->t('fax'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($fax); $adress = new Zend_Form_Element_Text('adress'); $adress->setOptions(array('label' => $this->t('adress'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($adress); $description = new Zend_Form_Element_Text('description'); $description->setOptions(array('label' => $this->t('description'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($description); $submit = new Zend_Form_Element_Submit('submit'); $submit->setOptions(array('label' => $this->t('Save'), 'required' => true)); $this->addElement($submit); }
/** * 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'); $groupModel = new Group(); $groupsOptions = $groupModel->findPairs(); $uniqueUsernameValidator = new Zend_Validate_Db_NoRecordExists(array('table' => 'backoffice_users', 'field' => 'username')); $uniqueEmailValidator = new Zend_Validate_Db_NoRecordExists(array('table' => 'backoffice_users', 'field' => 'email')); $groupsInArrayValidator = new Zend_Validate_InArray(array_keys($groupsOptions)); $groupsInArrayValidator->setMessage('Please select at least one group. If you are not sure about which group is better, select "member".'); $username = new Zend_Form_Element_Text('username'); $username->setOptions(array('label' => 'Username', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty', $uniqueUsernameValidator))); $this->addElement($username); $email = new Zend_Form_Element_Text('email'); $email->setOptions(array('label' => 'Email', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty', $uniqueEmailValidator))); $this->addElement($email); $firstname = new Zend_Form_Element_Text('firstname'); $firstname->setOptions(array('label' => 'First name', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($firstname); $lastname = new Zend_Form_Element_Text('lastname'); $lastname->setOptions(array('label' => 'Last name', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($lastname); $phoneNumber = new Zend_Form_Element_Text('phone_number'); $phoneNumber->setOptions(array('label' => 'Phone number', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($phoneNumber); $groups = new Zend_Form_Element_MultiCheckbox('groups'); $groups->setOptions(array('label' => 'Select the one or more user groups for this user', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty', $groupsInArrayValidator), 'multiOptions' => $groupsOptions)); $this->addElement($groups); $id = new Zend_Form_Element_Hidden('id'); $id->setOptions(array('validators' => array(new Zend_Validate_Regex('/^\\d*$/')))); $this->addElement($id); $submit = new Zend_Form_Element_Submit('submit'); $submit->setOptions(array('label' => 'Save user', 'required' => true, 'order' => 100)); $this->addElement($submit); $this->addDisplayGroup(array('username', 'email', 'firstname', 'lastname', 'phone_number'), 'userdata')->getDisplayGroup('userdata')->setLegend('User details'); $this->addDisplayGroup(array('groups'), 'usergroups')->getDisplayGroup('usergroups')->setLegend('Groups'); }
/** * Overrides init() in Zend_Form * * @access public * @return void */ public function init() { // init the parent parent::init(); // set the form's method $idMember = App_Utilities::getIdMember(); $member_id = new Zend_Form_Element_Hidden('member_id'); $member_id->addFilter('Int')->setValue($idMember); $this->addElement($member_id); $firstName = new Zend_Form_Element_Text('fistName_son'); $firstName->setOptions(array('value' => $this->t('First name'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($firstName); $lastName = new Zend_Form_Element_Text('lastName_son'); $lastName->setOptions(array('value' => $this->t('Last name'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($lastName); $email = new Zend_Form_Element_Text('email_son'); $email->setOptions(array('value' => $this->t('email'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($email); $submit = new Zend_Form_Element_Submit('submit_sponsor'); $submit->setOptions(array('label' => $this->t('Envoyer mon invitation'), 'required' => true)); $this->addElement($submit); }
/** * 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'); $uniqueGroupNameValidator = new Zend_Validate_Db_NoRecordExists(array('table' => 'groups', 'field' => 'name')); $groupModel = new Group(); $parentIdOptions = $groupModel->findPairs(); $name = new Zend_Form_Element_Text('name'); $name->setOptions(array('label' => 'Name', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty', $uniqueGroupNameValidator))); $this->addElement($name); $parentId = new Zend_Form_Element_Select('parent_id'); $parentId->setOptions(array('label' => 'Parent group', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'), 'multiOptions' => $parentIdOptions)); $this->addElement($parentId); $id = new Zend_Form_Element_Hidden('id'); $id->setOptions(array('validators' => array(new Zend_Validate_Regex('/^\\d*$/')))); $this->addElement($id); $submit = new Zend_Form_Element_Submit('submit'); $submit->setOptions(array('label' => 'Save user group', 'required' => true)); $this->addElement($submit); }
public function init() { $this->setMethod('post'); $this->setAction(BASE_URL . 'dashboard/editpassword'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'editpassword'); $id = new Zend_Form_Element_Hidden('id'); $oldPassword = new Zend_Form_Element_Password('password'); $oldPassword->setAttrib('size', 20); $oldPassword->addValidator('NotEmpty', false, array('messages' => 'Please enter current password.')); $oldPassword->setAttrib('maxLength', 15); $oldPassword->setRequired(true); $oldPassword->addFilters(array('StringTrim')); $newPassword = new Zend_Form_Element_Password('newpassword'); $newPassword->setAttrib('size', 20); $newPassword->setAttrib('maxLength', 15); $newPassword->setRequired(true); $newPassword->addValidator('NotEmpty', false, array('messages' => 'Please enter new password.')); $newPassword->addValidator('stringLength', true, array('min' => 6, 'max' => 15, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'The password cannot be more than 15 characters.', Zend_Validate_StringLength::TOO_SHORT => 'New password should be atleast 6 characters long.'))); $newPassword->addFilters(array('StringTrim')); $newPasswordAgain = new Zend_Form_Element_Password('passwordagain'); $newPasswordAgain->setAttrib('size', 20); $newPasswordAgain->setAttrib('maxLength', 15); $newPasswordAgain->setRequired(true); $newPasswordAgain->addValidator('NotEmpty', false, array('messages' => 'Please enter confirm password.')); $newPasswordAgain->addValidator('stringLength', true, array('min' => 6, 'max' => 15, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'The password cannot be more than 15 characters.', Zend_Validate_StringLength::TOO_SHORT => 'Confirm password should be atleast 6 characters long.'))); $newPasswordAgain->addFilters(array('StringTrim')); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $url = "'dashboard/editpassword/format/json'"; $dialogMsg = "''"; $toggleDivId = "''"; $jsFunction = "''"; $submit->setOptions(array('onclick' => "saveDetails({$url},{$dialogMsg},{$toggleDivId},{$jsFunction});")); $this->addElements(array($id, $oldPassword, $newPassword, $newPasswordAgain, $submit)); $this->setElementDecorators(array('ViewHelper')); }
/** * 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'); $idMember = App_Utilities::getIdMember(); $member_id = new Zend_Form_Element_Hidden('member_id'); $member_id->addFilter('Int')->setValue($idMember); $this->addElement($member_id); $start_date = new Zend_Form_Element_Text('start_date'); $start_date->setOptions(array('label' => $this->t('Start date'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($start_date); $end_date = new Zend_Form_Element_Text('end_date'); $end_date->setOptions(array('label' => $this->t('End Date'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($end_date); $schoolName = new Zend_Form_Element_Text('school'); $schoolName->setOptions(array('label' => $this->t('School Name'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($schoolName); $domain = new Zend_Form_Element_Text('domain'); $domain->setOptions(array('label' => $this->t('domain'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($domain); $degree = new Zend_Form_Element_Text('degree'); $degree->setOptions(array('label' => $this->t('Degree'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($degree); $result = new Zend_Form_Element_Text('result'); $result->setOptions(array('label' => $this->t('Result'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($result); $activity = new Zend_Form_Element_Text('activity'); $activity->setOptions(array('label' => $this->t('Activity'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($activity); $information_add = new Zend_Form_Element_Text('information_add'); $information_add->setOptions(array('label' => $this->t('Additional Information'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($information_add); $submit = new Zend_Form_Element_Submit('submit'); $submit->setOptions(array('label' => $this->t('Save'), 'required' => true)); $this->addElement($submit); }
/** * 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'); $flagModel = new Flag(); $flagIdOptions = $flagModel->findPairs(); $name = new Zend_Form_Element_Text('name'); $name->setOptions(array('label' => 'Name', 'required' => TRUE, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($name); $flagId = new Zend_Form_Element_Select('flag_id'); $flagId->setOptions(array('label' => 'Flag', 'required' => TRUE, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'), 'multiOptions' => $flagIdOptions)); $this->addElement($flagId); $description = new Zend_Form_Element_Text('description'); $description->setOptions(array('label' => 'Description', 'required' => TRUE, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($description); $id = new Zend_Form_Element_Hidden('id'); $id->setOptions(array('validators' => array(new Zend_Validate_Regex('/^\\d*$/')))); $this->addElement($id); $submit = new Zend_Form_Element_Submit('submit'); $submit->setOptions(array('label' => 'Save privilege', 'required' => TRUE)); $this->addElement($submit); }
/** * * @param mixed $options * * @return void * */ public function __construct($options = null) { parent::__construct($options = null); $this->setAction('/default/press-reviews-subscriber/post')->setMethod('post'); $emailDefaultValue = __("Email", "s1b"); // Email element $emailElement = new \Zend_Form_Element_Text("email"); $emailElement->addValidator("emailAddress", false, array("messages" => array(\Zend_Validate_EmailAddress::INVALID => __("Le type reçu est invalide. Une chaine de caractère est attendue.", "s1b"), \Zend_Validate_EmailAddress::INVALID_FORMAT => __("'%value%' n'est pas un email valide.", "s1b"), \Zend_Validate_EmailAddress::INVALID_HOSTNAME => __("'%hostname%' n'est pas un nom d'hôte valide pour l'adresse email '%value%'.", "s1b"), \Zend_Validate_EmailAddress::INVALID_MX_RECORD => __("'%hostname%' ne semble pas avoir d'enregistrement MX valide pour l'adresse email '%value%'.", "s1b"), \Zend_Validate_EmailAddress::INVALID_SEGMENT => __("'%hostname%' n'est pas un segment réseau accessible. L'adresse email %value%' n'est pas accessible pour les réseaux publics.", "s1b"), \Zend_Validate_EmailAddress::LENGTH_EXCEEDED => __("'%value%' a dépassé la taille maximale.", "s1b"))))->addValidator(new PressReviewsSubscriberExists(), false)->setRequired(true)->setValue($emailDefaultValue); $this->removeAllDecorators($emailElement); $emailElement->class = "input-item"; $emailElement->setAttrib("auto-restore", ""); // Submit button element $subscribeButtonElement = new \Zend_Form_Element_Submit("subscribe"); $subscribeButtonElement->setOptions(array('label' => __("S'abonner", "s1b"))); $this->removeAllDecorators($subscribeButtonElement); $subscribeButtonElement->class = "button bt-blue-m"; // Email default label element $emailDefaultLabelHidden = new \Zend_Form_Element_Hidden("emailDefaultLabel"); $emailDefaultLabelHidden->setValue($emailDefaultValue); $emailDefaultLabelHidden->class = "default-value"; $this->removeAllDecorators($emailDefaultLabelHidden); $this->addElements(array($emailElement, $emailDefaultLabelHidden, $subscribeButtonElement)); $this->removeDecorator("HtmlTag"); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'leaverequest'); $id = new Zend_Form_Element_Hidden('id'); $availableleaves = new Zend_Form_Element_Text('no_of_days'); $availableleaves->setAttrib('readonly', 'true'); $availableleaves->setAttrib('onfocus', 'this.blur()'); $appliedleavesdaycount = new Zend_Form_Element_Text('appliedleavesdaycount'); $appliedleavesdaycount->setAttrib('readonly', 'true'); $appliedleavesdaycount->setAttrib('onfocus', 'this.blur()'); $repmanagerid = new Zend_Form_Element_Text('rep_mang_id'); $repmanagerid->setAttrib('readonly', 'true'); $repmanagerid->setAttrib('onfocus', 'this.blur()'); $issatholiday = new Zend_Form_Element_Hidden('is_sat_holiday'); $leavetypeid = new Zend_Form_Element_Select('leavetypeid'); $leavetypeid->setAttrib('class', 'selectoption'); $leavetypeid->addMultiOption('', 'Select Leave Type'); $leavetypeid->setRegisterInArrayValidator(false); $leavetypeid->setRequired(true); $leavetypeid->addValidator('NotEmpty', false, array('messages' => 'Please select leave type.')); $leaveday = new Zend_Form_Element_Select('leaveday'); $leaveday->setRegisterInArrayValidator(false); $leaveday->setAttrib('onchange', 'hidetodatecalender(this)'); $leaveday->setMultiOptions(array('1' => 'Full Day', '2' => 'Half Day')); $leaveday->setRequired(true); $leaveday->addValidator('NotEmpty', false, array('messages' => 'Please select date.')); $from_date = new ZendX_JQuery_Form_Element_DatePicker('from_date'); $from_date->setAttrib('readonly', 'true'); $from_date->setAttrib('onfocus', 'this.blur()'); $from_date->setOptions(array('class' => 'brdr_none')); $from_date->setRequired(true); $from_date->addValidator('NotEmpty', false, array('messages' => 'Please select date.')); $to_date = new ZendX_JQuery_Form_Element_DatePicker('to_date'); $to_date->setAttrib('readonly', 'true'); $to_date->setAttrib('onfocus', 'this.blur()'); $to_date->setAttrib('onblur', 'validate_todate()'); $to_date->setOptions(array('class' => 'brdr_none')); $reason = new Zend_Form_Element_Textarea('reason'); $reason->setAttrib('rows', 10); $reason->setAttrib('cols', 50); $reason->setAttrib('maxlength', '400'); $reason->setRequired(true); $reason->addValidator('NotEmpty', false, array('messages' => 'Please enter reason.')); $leavestatus = new Zend_Form_Element_Text('leavestatus'); $leavestatus->setAttrib('readonly', 'true'); $leavestatus->setAttrib('onfocus', 'this.blur()'); $createddate = new Zend_Form_Element_Text('createddate'); $createddate->setAttrib('readonly', 'true'); $createddate->setAttrib('onfocus', 'this.blur()'); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Apply'); $url = "'leaverequest/saveleaverequestdetails/format/json'"; $dialogMsg = "''"; $toggleDivId = "''"; $jsFunction = "''"; $submit->setOptions(array('onclick' => "saveDetails({$url},{$dialogMsg},{$toggleDivId},{$jsFunction});")); $this->addElements(array($id, $reason, $availableleaves, $repmanagerid, $leaveday, $from_date, $to_date, $leavetypeid, $issatholiday, $appliedleavesdaycount, $leavestatus, $createddate, $submit)); $this->setElementDecorators(array('ViewHelper')); $this->setElementDecorators(array('UiWidgetElement'), array('from_date', 'to_date')); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'usermanagement'); $company_id = new Zend_Form_Element_Hidden("company_id"); $id = new Zend_Form_Element_Hidden("id"); $id_val = Zend_Controller_Front::getInstance()->getRequest()->getParam('id', null); $employeeId = new Zend_Form_Element_Select("employeeId"); $employeeId->setRegisterInArrayValidator(false); $employeeId->setLabel("User Type"); $employeeId->setAttrib("class", "formDataElement"); if ($id_val == '') { $employeeId->setRequired(true); $employeeId->addValidator('NotEmpty', false, array('messages' => 'Please configure identity codes.')); } /*$userfullname = new Zend_Form_Element_Text("userfullname"); $userfullname->setLabel("Full Name"); $userfullname->setAttrib("class", "formDataElement"); $userfullname->setRequired("true"); $userfullname->addValidator('NotEmpty', false, array('messages' => 'Please enter full name.')); $userfullname->addValidator("regex",true,array( 'pattern'=>'/^[a-zA-Z.\- ?]+$/', 'messages'=>array( 'regexNotMatch'=>'Please enter valid full name.' ) ));*/ $firstname = new Zend_Form_Element_Text("firstname"); $firstname->setLabel("First Name"); $firstname->setAttrib("class", "formDataElement"); $firstname->setRequired("true"); $firstname->addValidator('NotEmpty', false, array('messages' => 'Please enter first name.')); $firstname->addValidator("regex", true, array('pattern' => '/^[a-zA-Z.\\- ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid first name.'))); $lastname = new Zend_Form_Element_Text("lastname"); $lastname->setLabel("Last Name"); $lastname->setAttrib("class", "formDataElement"); $lastname->setRequired("true"); $lastname->addValidator('NotEmpty', false, array('messages' => 'Please enter last name.')); $lastname->addValidator("regex", true, array('pattern' => '/^[a-zA-Z.\\- ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid last name.'))); $entrycomments = new Zend_Form_Element_Textarea("entrycomments"); $entrycomments->setLabel("Comments")->setAttrib("COLS", "40")->setAttrib("ROWS", "4"); $entrycomments->setAttrib("class", "formDataElement"); $selecteddate = new Zend_Form_Element_Text("selecteddate"); $selecteddate->setLabel("Date of Selection"); $selecteddate->setAttrib('readonly', 'readonly'); $selecteddate->setAttrib('onfocus', 'this.blur()'); $emailaddress = new Zend_Form_Element_Text("emailaddress"); $emailaddress->setRequired("true"); $emailaddress->addValidator('NotEmpty', false, array('messages' => 'Please enter email.')); $emailaddress->addValidator("regex", true, array('pattern' => '/^(?!.*\\.{2})[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\\.[a-zA-Z0-9-.]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid email.'))); $emailaddress->setLabel("Email"); $emailaddress->setAttrib("class", "formDataElement"); $emailaddress->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_users', 'field' => 'emailaddress', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" '))); $emailaddress->getValidator('Db_NoRecordExists')->setMessage('Email already exists.'); $act_inact = new Zend_Form_Element_Hidden("act_inact"); $empreasonlocked = new Zend_Form_Element_Textarea("empreasonlocked"); $empreasonlocked->setLabel("Reason Locked")->setAttrib("COLS", "40")->setAttrib("ROWS", "4"); $empreasonlocked->setAttrib("class", "formDataElement"); $emplockeddate = new Zend_Form_Element_Text("emplockeddate"); $emplockeddate->setLabel("Date Locked"); $emplockeddate->setAttrib('readonly', 'readonly'); $emplockeddate->setAttrib('onfocus', 'this.blur()'); $temp_lock = Zend_Controller_Front::getInstance()->getRequest()->getParam('emptemplock', null); $temp_lock_date = Zend_Controller_Front::getInstance()->getRequest()->getParam('emplockeddate', null); $emprole = new Zend_Form_Element_Select("emprole"); $emprole->setRegisterInArrayValidator(false); $emprole->setRequired("true"); $emprole->setLabel("Assign Role"); $emprole->setAttrib("class", "formDataElement"); $emprole->addValidator('NotEmpty', false, array('messages' => 'Please select role.')); $submit = new Zend_Form_Element_Submit("submit"); $submit->setLabel("Save"); $submit->setAttrib('id', 'submitbutton'); $submit->setAttrib("class", "formSubmitButton"); $url = "'usermanagement/saveupdate/format/json'"; $dialogMsg = "''"; $toggleDivId = "''"; $jsFunction = "'redirecttocontroller(\\'usermanagement\\');'"; $submit->setOptions(array('onclick' => "saveDetails({$url},{$dialogMsg},{$toggleDivId},{$jsFunction});")); $this->addElements(array($id, $submit, $company_id, $employeeId, $firstname, $lastname, $entrycomments, $selecteddate, $emailaddress, $act_inact, $empreasonlocked, $emplockeddate, $emprole)); $this->setElementDecorators(array('ViewHelper')); }