public function __construct($option = null) { parent::__construct($option); $this->setName('register'); $this->setAttrib('class', 'input-group'); $username = new Zend_Form_Element_Text('username'); $username->setRequired(true)->setAttrib('class', "form-control")->addFilter(new Zend_Filter_StringTrim())->addValidator(new Zend_Validate_StringLength(4, 20))->addValidator('regex', true, array('/^[(a-zA-Z0-9)]+$/'))->setAttrib('placeholder', "Хэрэглэгчийн нэр")->addValidator('Db_NoRecordExists', true, array('table' => 'users', 'field' => 'username'))->setLabel("Дүн.мн хэрэглэгчийн бүртгүүлэх хэсэг"); $password = new Zend_Form_Element_Password('password'); $password->setRequired(true)->setAttrib('placeholder', "Нууц үг")->setAttrib('class', "form-control")->addFilter(new Zend_Filter_StringTrim())->addValidator(new Zend_Validate_StringLength(8, 20)); $confirmPassword = new Zend_Form_Element_Password('confirm_password'); $confirmPassword->setAttrib('class', "form-control"); $token = Zend_Controller_Front::getInstance()->getRequest()->getPost('password'); $confirmPassword->setRequired(true)->setAttrib('placeholder', "Нууц үгээ давтана уу?")->setAttrib('class', "form-control")->addFilter(new Zend_Filter_StringTrim())->addValidator(new Zend_Validate_Identical(trim($token))); $firstname = new Zend_Form_Element_Text('firstname'); $firstname->setAttrib('placeholder', "Таны нэр")->addFilter(new Zend_Filter_StringTrim())->addValidator(new Zend_Validate_NotEmpty())->setAttrib('class', "form-control"); $lastname = new Zend_Form_Element_Text('lastname'); $lastname->setAttrib('placeholder', "Таны овог")->addFilter(new Zend_Filter_StringTrim())->addValidator(new Zend_Validate_NotEmpty())->setAttrib('class', "form-control"); $date = new Zend_Form_Element_Text('date'); $date->setAttrib('placeholder', "Төрсөн он сар өдөр (он-сар-өдөр)")->addFilter(new Zend_Filter_StringTrim())->addValidator(new Zend_Validate_NotEmpty())->setAttrib('class', "form-control"); $email = new Zend_Form_Element_Text('email'); $email->addFilters(array('StringTrim', 'StripTags'))->setAttrib('placeholder', "Таны цахим хаяг")->addValidator('EmailAddress', TRUE)->addValidator('Db_NoRecordExists', true, array('table' => 'users', 'field' => 'E-mail'))->addValidator(new Zend_Validate_NotEmpty())->setAttrib('class', "form-control"); $submit = new Zend_Form_Element_Submit('register'); $submit->setLabel('Бүртгүүлэх')->setAttrib('class', 'btn'); $this->addElement($username); $this->addElement($password); $this->addElement($confirmPassword); $this->addElement($firstname); $this->addElement($lastname); $this->addElement($date); $this->addElement($email); $this->addElement($submit); $this->setMethod('post'); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'emailcontacts'); $this->setAttrib('action', BASE_URL . 'emailcontacts/add/'); $id = new Zend_Form_Element_Hidden('id'); $group_id = new Zend_Form_Element_Select("group_id"); $group_id->setRegisterInArrayValidator(false); $group_id->setRequired(true); $group_id->addValidator('NotEmpty', false, array('messages' => 'Please select group.')); $business_unit_id = new Zend_Form_Element_Select("business_unit_id"); $business_unit_id->setRegisterInArrayValidator(false); $business_unit_id->setRequired(true); $business_unit_id->addValidator('NotEmpty', false, array('messages' => 'Please select business unit.')); $business_unit_id->setAttrib('onchange', "bunit_emailcontacts('business_unit_id');"); //Group Email.... $grpEmail = new Zend_Form_Element_Text('groupEmail'); $grpEmail->addFilters(array('StringTrim', 'StripTags')); $grpEmail->setRequired(true); $grpEmail->addValidator('NotEmpty', false, array('messages' => 'Please enter group email.')); $grpEmail->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.'))); $grpEmail->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_emailcontacts', 'field' => 'groupEmail', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive = 1'))); $grpEmail->getValidator('Db_NoRecordExists')->setMessage('Group email already exists.'); // Form Submit ......... $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $this->addElements(array($id, $group_id, $grpEmail, $submit, $business_unit_id)); $this->setElementDecorators(array('ViewHelper')); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'empsalarydetails'); $id = new Zend_Form_Element_Hidden('id'); $userid = new Zend_Form_Element_Hidden('user_id'); $currencyid = new Zend_Form_Element_Select('currencyid'); $currencyid->setLabel('Salary Currency'); $currencyid->setRegisterInArrayValidator(false); $salarytype = new Zend_Form_Element_Select('salarytype'); $salarytype->setLabel("Pay Frequency"); $salarytype->setAttrib('id', 'jobpayfrequency'); //$salarytype->setAttrib('onchange', 'changesalarytext(this)'); $salarytype->setRegisterInArrayValidator(false); /* $salarytype->setMultiOptions(array( '' => 'Select Salary Type', '1'=>'Yearly' , '2'=>'Hourly', )); */ $salary = new Zend_Form_Element_Text('salary'); $salary->setLabel("Salary"); $salary->setAttrib('maxLength', 8); $salary->addFilter(new Zend_Filter_StringTrim()); $salary->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[0-9\\.]*$/', 'messages' => array('regexNotMatch' => 'Please enter only numbers.'))))); $bankname = new Zend_Form_Element_Text('bankname'); $bankname->setAttrib('maxlength', 40); $bankname->setLabel('Bank Name'); $bankname->addFilters(array('StringTrim')); $bankname->addValidator("regex", true, array('pattern' => '/^[a-zA-Z][a-zA-Z0-9\\-\\. ]*$/', 'messages' => array('regexNotMatch' => 'Please enter valid bank name.'))); $accountholder_name = new Zend_Form_Element_Text('accountholder_name'); $accountholder_name->setAttrib('maxlength', 40); $accountholder_name->setLabel('Account Holder Name'); $accountholder_name->addFilters(array('StringTrim')); $accountholder_name->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z\\s]+$/i', 'messages' => array('regexNotMatch' => 'Please enter only alphabets.'))))); $accountholding = new ZendX_JQuery_Form_Element_DatePicker('accountholding'); $accountholding->setLabel('Account Holding Since'); $accountholding->setAttrib('readonly', 'true'); $accountholding->setAttrib('onfocus', 'this.blur()'); $accountholding->setOptions(array('class' => 'brdr_none')); $accountclasstypeid = new Zend_Form_Element_Select('accountclasstypeid'); $accountclasstypeid->setLabel('Account Class Type'); $accountclasstypeid->setRegisterInArrayValidator(false); $bankaccountid = new Zend_Form_Element_Select('bankaccountid'); $bankaccountid->setLabel('Account Type'); $bankaccountid->setRegisterInArrayValidator(false); $accountnumber = new Zend_Form_Element_Text('accountnumber'); $accountnumber->setAttrib('maxlength', 20); $accountnumber->setLabel('Account Number'); $accountnumber->addFilters(array('StringTrim')); $accountnumber->addValidator("regex", true, array('pattern' => '/^[a-zA-Z0-9 ]*$/', 'messages' => array('regexNotMatch' => 'Please enter only alphanumeric characters.'))); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $this->addElements(array($id, $userid, $currencyid, $salarytype, $salary, $bankname, $accountholder_name, $accountholding, $accountclasstypeid, $bankaccountid, $accountnumber, $submit)); $this->setElementDecorators(array('ViewHelper')); $this->setElementDecorators(array('UiWidgetElement'), array('accountholding')); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'creditcarddetails'); $id = new Zend_Form_Element_Hidden('id'); $user_id = new Zend_Form_Element_Hidden('user_id'); //Card Type....(only alphabets) $cardType = new Zend_Form_Element_Text('card_type'); $cardType->addFilter(new Zend_Filter_StringTrim()); $cardType->setAttrib('maxLength', 50); $cardType->addValidators(array(array('StringLength', false, array('min' => 2, 'max' => 50, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Card type must contain at most %max% characters.', Zend_Validate_StringLength::TOO_SHORT => 'Card type must contain at least %min% characters.'))))); $cardType->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z\\s]+$/i', 'messages' => array('regexNotMatch' => 'Please enter only alphabets.'))))); //Card Number.... $cardNum = new Zend_Form_Element_Text('card_number'); $cardNum->addFilters(array('StringTrim', 'StripTags')); $cardNum->setAttrib("maxlength", 16); $cardNum->addValidators(array(array('StringLength', false, array('min' => 16, 'max' => 16, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Card number must contain at most %max% characters.', Zend_Validate_StringLength::TOO_SHORT => 'Card number must contain at least %min% characters.'))))); $cardNum->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_empcreditcarddetails', 'field' => 'card_number', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '"'))); $cardNum->getValidator('Db_NoRecordExists')->setMessage('Card number already exists.'); $cardNum->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[0-9]+$/i', 'messages' => array('regexNotMatch' => 'Please enter only numbers.'))))); //Name on the card .... (only Alphabets) $nameoncard = new Zend_Form_Element_Text('nameoncard'); $nameoncard->addFilter(new Zend_Filter_StringTrim()); $nameoncard->setAttrib('maxLength', 50); $nameoncard->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z\\s]+$/i', 'messages' => array('regexNotMatch' => 'Please enter only alphabets.'))))); // Card Expiration Date .... $card_expired_date = new ZendX_JQuery_Form_Element_DatePicker('card_expiration'); $card_expired_date->setOptions(array('class' => 'brdr_none')); $card_expired_date->setAttrib('readonly', 'true'); $card_expired_date->setAttrib('onfocus', 'this.blur()'); // Expiration Date should be greater than today's date... $card_expired_date->addValidator(new sapp_DateGreaterThanToday()); //Card Code ... $card_code = new Zend_Form_Element_Text('card_code'); $card_code->addFilter(new Zend_Filter_StringTrim()); $card_code->setAttrib('maxLength', 4); $card_code->addValidators(array(array('StringLength', false, array('min' => 3, 'max' => 4, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Card code must contain at most %max% characters.', Zend_Validate_StringLength::TOO_SHORT => 'Card code must contain at least %min% characters.'))))); $card_code->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[0-9]+$/i', 'messages' => array('regexNotMatch' => 'Please enter only numbers.'))))); //Card issued by....(company name) $card_issuedBy = new Zend_Form_Element_Text('card_issuedby'); $card_issuedBy->addFilter(new Zend_Filter_StringTrim()); $card_issuedBy->setAttrib('maxLength', 50); $card_issuedBy->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z\\s]+$/i', 'messages' => array('regexNotMatch' => 'Please enter only alphabets.'))))); // Form Submit ......... $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $this->addElements(array($id, $user_id, $cardType, $cardNum, $nameoncard, $card_expired_date, $card_issuedBy, $card_code, $submit)); $this->setElementDecorators(array('ViewHelper')); $this->setElementDecorators(array('UiWidgetElement'), array('card_expiration')); }
protected function elementText($title, $options = null, $conf = null) { $element = new Zend_Form_Element_Text($title); if (is_array($options)) { $element->setOptions($options); } elseif (!is_null($options)) { $element->setLabel($options); } $element->addFilter('StringTrim'); if (!empty($conf['filters'])) { $element->addFilters($conf['filters']); } if (!empty($conf['validators'])) { $element->addValidators($conf['validators']); } return $element; }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'experiencedetails'); $id = new Zend_Form_Element_Hidden('id'); $user_id = new Zend_Form_Element_Hidden('user_id'); //company_name ... $company_name = new Zend_Form_Element_Text('comp_name'); $company_name->addFilter(new Zend_Filter_StringTrim()); $company_name->setRequired(true); $company_name->setAttrib("maxlength", 50); $company_name->addValidator('NotEmpty', false, array('messages' => 'Please enter company name.')); $company_name->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z][a-zA-Z0-9\\-\\s]+$/i', 'messages' => array('regexNotMatch' => 'Please enter valid company name.'))))); //Company website ... $comp_website = new Zend_Form_Element_Text('comp_website'); $comp_website->addFilter(new Zend_Filter_StringTrim()); $comp_website->setAttrib('maxLength', 50); $comp_website->setRequired(false); $comp_website->addValidator('NotEmpty', false, array('messages' => 'Please enter company website.')); $comp_website->addValidator("regex", true, array('pattern' => '/^(http:\\/\\/www|https:\\/\\/www|www)+\\.([A-Za-z0-9_\\-\\.])+\\.([A-Za-z]{2,3})$/', 'messages' => array('regexNotMatch' => 'Please enter valid URL.'))); // designation... $designation = new Zend_Form_Element_Text('designation'); $designation->addFilter(new Zend_Filter_StringTrim()); $designation->setAttrib("maxlength", 50); $designation->setRequired(true); $designation->addValidator('NotEmpty', false, array('messages' => 'Please enter designation.')); $designation->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z\\.\\-\\s]+$/i', 'messages' => array('regexNotMatch' => 'Please enter valid designation.'))))); //from_date.. $from_date = new ZendX_JQuery_Form_Element_DatePicker('from_date'); $from_date->setRequired(true); $from_date->addValidator('NotEmpty', false, array('messages' => 'Please select from date.')); $from_date->setAttrib('readonly', 'true'); $from_date->setAttrib('onfocus', 'this.blur()'); //to_date $to_date = new ZendX_JQuery_Form_Element_DatePicker('to_date'); $to_date->setRequired(true); $to_date->addValidator('NotEmpty', false, array('messages' => 'Please select to date.')); $to_date->setAttrib('readonly', 'true'); $to_date->setAttrib('onfocus', 'this.blur()'); // reason_for_leaving .... $reason_for_leaving = new Zend_Form_Element_Textarea('reason_for_leaving'); $reason_for_leaving->setAttrib('rows', 10); $reason_for_leaving->setAttrib('cols', 50); $reason_for_leaving->setRequired(true); $reason_for_leaving->addValidator('NotEmpty', false, array('messages' => 'Please enter reason for leaving.')); // Reference person Details.... //Referer name .... $reference_name = new Zend_Form_Element_Text('reference_name'); $reference_name->addFilter(new Zend_Filter_StringTrim()); $reference_name->setRequired(false); $reference_name->setAttrib("maxlength", 50); $reference_name->addValidator('NotEmpty', false, array('messages' => 'Please enter referrer name.')); $reference_name->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z][a-zA-Z0-9\\-\\s]+$/i', 'messages' => array('regexNotMatch' => 'Please enter valid referrer name.'))))); //Referer mobile number .... $reference_contact = new Zend_Form_Element_Text('reference_contact'); $reference_contact->addFilter(new Zend_Filter_StringTrim()); $reference_contact->setRequired(false); $reference_contact->setAttrib("maxlength", 10); $reference_contact->addValidator('NotEmpty', false, array('messages' => 'Please enter referrer contact.')); $reference_contact->addValidators(array(array('StringLength', false, array('min' => 10, 'max' => 10, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Referrer contact must contain at most of 10 numbers.', Zend_Validate_StringLength::TOO_SHORT => 'Referrer contact must contain at least of %min% characters.'))))); $reference_contact->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[0-9]+$/i', 'messages' => array('regexNotMatch' => 'Please enter only numbers.'))))); //Referer Email.... $reference_email = new Zend_Form_Element_Text('reference_email'); $reference_email->addFilters(array('StringTrim', 'StripTags')); $reference_email->setRequired(false); $reference_email->setAttrib("maxlength", 50); $reference_email->addValidator('NotEmpty', false, array('messages' => 'Please enter referrer email.')); $reference_email->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.'))); //Form Submit.... $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $this->addElements(array($id, $user_id, $company_name, $comp_website, $designation, $from_date, $to_date, $reason_for_leaving, $reference_name, $reference_contact, $reference_email, $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', 'visaandimmigrationdetails'); $id = new Zend_Form_Element_Hidden('id'); $user_id = new Zend_Form_Element_Hidden('user_id'); //Passport number....(only alphanumerics) $passport_num = new Zend_Form_Element_Text('passport_number'); $passport_num->addFilter(new Zend_Filter_StringTrim()); $passport_num->setAttrib('maxLength', 20); $passport_num->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z0-9]+$/i', 'messages' => array('regexNotMatch' => 'Please enter valid passport number.'))))); $passport_num->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_empvisadetails', 'field' => 'passport_number', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '"'))); $passport_num->getValidator('Db_NoRecordExists')->setMessage('Passport number already exists.'); //passport_issue_date.... $passport_issue_date = new ZendX_JQuery_Form_Element_DatePicker('passport_issue_date'); $passport_issue_date->setOptions(array('class' => 'brdr_none')); $passport_issue_date->setAttrib('readonly', 'true'); $passport_issue_date->setAttrib('onfocus', 'this.blur()'); //Passport Expiration Date .... $passport_expiry_date = new ZendX_JQuery_Form_Element_DatePicker('passport_expiry_date'); $passport_expiry_date->setOptions(array('class' => 'brdr_none')); $passport_expiry_date->setAttrib('readonly', 'true'); $passport_expiry_date->setAttrib('onfocus', 'this.blur()'); // Expiration Date should be greater than today's date... $passport_expiry_date->addValidator(new sapp_DateGreaterThanToday()); //Visa Number ..... $visaNum = new Zend_Form_Element_Text('visa_number'); $visaNum->addFilters(array('StringTrim', 'StripTags')); $visaNum->setAttrib('maxLength', 20); $visaNum->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_empvisadetails', 'field' => 'visa_number', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '"'))); $visaNum->getValidator('Db_NoRecordExists')->setMessage('Visa number already exists.'); //visa_type....(alphanumerics with '-' as only spl character) $visaType = new Zend_Form_Element_Text('visa_type'); $visaType->addFilter(new Zend_Filter_StringTrim()); $visaType->setAttrib('maxLength', 3); $visaType->addValidators(array(array('StringLength', false, array('min' => 2, 'max' => 3, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Visa type code must contain at most %max% characters', Zend_Validate_StringLength::TOO_SHORT => 'Visa type code must contain at least %min% characters'))))); $visaType->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z0-9\\-\\s]+$/i', 'messages' => array('regexNotMatch' => 'Please enter valid visa type code.'))))); //Visa issue_date.... $visa_issue_date = new ZendX_JQuery_Form_Element_DatePicker('visa_issue_date'); $visa_issue_date->setOptions(array('class' => 'brdr_none')); $visa_issue_date->setAttrib('readonly', 'true'); $visa_issue_date->setAttrib('onfocus', 'this.blur()'); //Visa Expiration Date .... $visa_expiry_date = new ZendX_JQuery_Form_Element_DatePicker('visa_expiry_date'); $visa_expiry_date->setOptions(array('class' => 'brdr_none')); $visa_expiry_date->setAttrib('readonly', 'true'); $visa_expiry_date->setAttrib('onfocus', 'this.blur()'); // Expiration Date should be greater than today's date... $visa_expiry_date->addValidator(new sapp_DateGreaterThanToday()); //Inine_status ..... $i_nine_status = new Zend_Form_Element_Text('inine_status'); $i_nine_status->addFilter(new Zend_Filter_StringTrim()); $i_nine_status->setAttrib('maxLength', 50); $i_nine_status->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z\\s]+$/i', 'messages' => array('regexNotMatch' => 'Please enter only alphabets.'))))); // Inine_review_date.... $i_nine_review_date = new ZendX_JQuery_Form_Element_DatePicker('inine_review_date'); $i_nine_review_date->setOptions(array('class' => 'brdr_none')); $i_nine_review_date->setAttrib('readonly', 'true'); $i_nine_review_date->setAttrib('onfocus', 'this.blur()'); //issuing_authority ... (only alphabets with spaces) $issue_auth = new Zend_Form_Element_Text('issuing_authority'); $issue_auth->addFilter(new Zend_Filter_StringTrim()); $issue_auth->setAttrib('maxLength', 50); $issue_auth->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z\\s]+$/i', 'messages' => array('regexNotMatch' => 'Please enter only alphabets.'))))); //Ininetyfour_status.... $i_ninetyfour_status = new Zend_Form_Element_Text('ininetyfour_status'); $i_ninetyfour_status->addFilter(new Zend_Filter_StringTrim()); $i_ninetyfour_status->setAttrib('maxLength', 50); $i_nine_status->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z\\s]+$/i', 'messages' => array('regexNotMatch' => 'Please enter only alphabets.'))))); //Ininetyfour_expiry_date ... $i_ninetyfour_expiry_date = new ZendX_JQuery_Form_Element_DatePicker('ininetyfour_expiry_date'); $i_ninetyfour_expiry_date->setOptions(array('class' => 'brdr_none')); $i_ninetyfour_expiry_date->setAttrib('readonly', 'true'); $i_ninetyfour_expiry_date->setAttrib('onfocus', 'this.blur()'); // Expiration Date should be greater than today's date... $i_ninetyfour_expiry_date->addValidator(new sapp_DateGreaterThanToday()); // Form Submit ......... $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $this->addElements(array($id, $user_id, $passport_num, $passport_issue_date, $passport_expiry_date, $visaNum, $visaType, $visa_issue_date, $visa_expiry_date, $i_nine_status, $i_nine_review_date, $issue_auth, $i_ninetyfour_status, $i_ninetyfour_expiry_date, $submit)); $this->setElementDecorators(array('ViewHelper')); $this->setElementDecorators(array('UiWidgetElement'), array('inine_review_date', 'ininetyfour_expiry_date', 'passport_issue_date', 'passport_expiry_date', 'visa_issue_date', 'visa_expiry_date')); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'empadditionaldetails'); $id = new Zend_Form_Element_Hidden('id'); $userid = new Zend_Form_Element_Hidden('user_id'); $military_status = new Zend_Form_Element_Select('military_status'); $military_status->setLabel('Served in Military ?'); $military_status->setAttrib('onchange', 'displaydates(this)'); $military_status->setRegisterInArrayValidator(false); $military_status->setMultiOptions(array('' => 'Select Military Status', '1' => 'Yes', '2' => 'No')); $military_status->setRequired(true); $military_status->addValidator('NotEmpty', false, array('messages' => 'Please enter military status.')); $countries_served = new Zend_Form_Element_Select('countries_served'); $countries_served->setLabel('Countries Served'); $countries_served->setRegisterInArrayValidator(false); $branch_service = new Zend_Form_Element_Text('branch_service'); $branch_service->setAttrib('maxlength', 30); $branch_service->setLabel('Branch of Service'); $branch_service->addValidator("regex", true, array('pattern' => '/^[a-zA-Z][a-zA-Z0-9\\-\\. ]*$/', 'messages' => array('regexNotMatch' => 'Please enter valid branch of service.'))); $branch_service->addFilters(array('StringTrim')); $rank_achieved = new Zend_Form_Element_Text('rank_achieved'); $rank_achieved->setAttrib('maxlength', 30); $rank_achieved->setLabel('Rank Achieved'); $rank_achieved->addValidator("regex", true, array('pattern' => '/^[a-zA-Z][a-zA-Z0-9\\-\\. ]*$/', 'messages' => array('regexNotMatch' => 'Please enter valid rank achieved.'))); $rank_achieved->addFilters(array('StringTrim')); $from_date = new Zend_Form_Element_Text('from_date'); $from_date->setLabel('From'); $from_date->setAttrib('readonly', 'true'); $from_date->setAttrib('onfocus', 'this.blur()'); $to_date = new Zend_Form_Element_Text('to_date'); $to_date->setLabel('To'); $to_date->setAttrib('readonly', 'true'); $to_date->setAttrib('onfocus', 'this.blur()'); $discharge_status = new Zend_Form_Element_Select('discharge_status'); $discharge_status->setLabel('Status of Discharge'); $discharge_status->setRegisterInArrayValidator(false); $discharge_status->setMultiOptions(array('' => 'Select Status', '1' => 'Honorable', '2' => 'Medical')); $service_number = new Zend_Form_Element_Text('service_number'); $service_number->setAttrib('maxlength', 30); $service_number->setLabel('Military Service Number'); $service_number->addValidator("regex", true, array('pattern' => '/^[a-zA-Z0-9\\-\\. ]*$/', 'messages' => array('regexNotMatch' => 'Please enter valid service number.'))); $service_number->addFilters(array('StringTrim')); $rank = new Zend_Form_Element_Text('rank'); $rank->setAttrib('maxlength', 30); $rank->setLabel('Current/Ending Rank'); $rank->addValidator("regex", true, array('pattern' => '/^[a-zA-Z][a-zA-Z0-9\\-\\. ]*$/', 'messages' => array('regexNotMatch' => 'Please enter valid current/ending rank.'))); $rank->addFilters(array('StringTrim')); $verification_report = new Zend_Form_Element_Text('verification_report'); $verification_report->setAttrib('maxlength', 30); $verification_report->setLabel('Military Verification Report'); $verification_report->addValidator("regex", true, array('pattern' => '/^[a-zA-Z][a-zA-Z0-9\\-\\. ]*$/', 'messages' => array('regexNotMatch' => 'Please enter valid verification report.'))); $verification_report->addFilters(array('StringTrim')); $military_servicetype = new Zend_Form_Element_Select('military_servicetype'); $military_servicetype->setLabel('Military Service Type'); $military_servicetype->setRegisterInArrayValidator(false); $veteran_status = new Zend_Form_Element_Select('veteran_status'); $veteran_status->setLabel('Veteran Status'); $veteran_status->setRegisterInArrayValidator(false); $special_training = new Zend_Form_Element_Textarea('special_training'); $special_training->setLabel('Special Trainings'); $special_training->setAttrib('rows', 10); $special_training->setAttrib('cols', 50); $special_training->setAttrib('maxlength', '400'); $special_training->addFilters(array('StringTrim')); $awards = new Zend_Form_Element_Textarea('awards'); $awards->setLabel('Awards/ Honors Received'); $awards->setAttrib('rows', 10); $awards->setAttrib('cols', 50); $awards->setAttrib('maxlength', '400'); $awards->addFilters(array('StringTrim')); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $this->addElements(array($id, $userid, $military_status, $countries_served, $branch_service, $rank_achieved, $from_date, $to_date, $discharge_status, $service_number, $rank, $verification_report, $military_servicetype, $veteran_status, $special_training, $awards, $submit)); $this->setElementDecorators(array('ViewHelper')); }