コード例 #1
1
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('id', 'agencylistreport');
     $this->setAttrib('name', 'agencylistreport');
     $this->setAttrib('action', DOMAIN . 'reports/agencylistreport');
     $agencyname = new Zend_Form_Element_Text('agencynamef');
     $agencyname->setLabel('Agency');
     $agencyname->setAttrib('onblur', 'clearagencyname(this)');
     $agencyname->setAttrib('maxLength', 50);
     $primaryphone = new Zend_Form_Element_Text('primaryphonef');
     $primaryphone->setLabel('Primary Phone');
     $primaryphone->setAttrib('onblur', 'blurelement(this)');
     $primaryphone->setAttrib('maxLength', 15);
     $primaryphone->addFilter(new Zend_Filter_StringTrim());
     $primaryphone->addValidators(array(array('StringLength', false, array('min' => 10, 'max' => 15, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Primary phone number must contain at most %max% characters', Zend_Validate_StringLength::TOO_SHORT => 'Primary phone number must contain at least %min% characters.')))));
     $primaryphone->addValidator("regex", true, array('pattern' => '/^(?!0{10})[0-9]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid phone number.')));
     $checktype = new Zend_Form_Element_Multiselect('bg_checktypef');
     $checktype->setLabel('Screening Type');
     $checktypeModal = new Default_Model_Bgscreeningtype();
     $typesData = $checktypeModal->fetchAll('isactive=1', 'type');
     foreach ($typesData->toArray() as $data) {
         $checktype->addMultiOption($data['id'], $data['type']);
     }
     $checktype->setRegisterInArrayValidator(false);
     $checktype->setAttrib('onchange', 'changeelement(this)');
     $website = new Zend_Form_Element_Text('website_urlf');
     $website->setLabel('Website Url');
     $website->setAttrib('maxLength', 50);
     $website->addFilter(new Zend_Filter_StringTrim());
     $website->setAttrib('onblur', 'clearagencyname(this)');
     $this->addElements(array($agencyname, $primaryphone, $checktype, $website));
     $this->setElementDecorators(array('ViewHelper'));
 }
コード例 #2
0
ファイル: identitycodes.php プロジェクト: rajbrt/sentrifugo
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'identitycodes');
     $id = new Zend_Form_Element_Hidden('id');
     //Employee Code
     $empCode = new Zend_Form_Element_Text('employee_code');
     $empCode->addFilter(new Zend_Filter_StringTrim());
     $empCode->setAttrib('maxLength', 5);
     $empCode->setRequired(true);
     $empCode->addValidator('NotEmpty', false, array('messages' => 'Please enter employee code.'));
     $empCode->addValidators(array(array('StringLength', false, array('min' => 1, 'max' => 5, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Employee code must contain at most %max% characters.', Zend_Validate_StringLength::TOO_SHORT => 'Employee code must contain at least %min% characters.')))));
     $empCode->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[A-Za-z][a-zA-Z@\\-]*$/', 'messages' => array(Zend_Validate_Regex::NOT_MATCH => 'Please enter valid employee code.')))));
     // Background Agency Code
     $bgCode = new Zend_Form_Element_Text('bg_code');
     $bgCode->addFilter(new Zend_Filter_StringTrim());
     $bgCode->setRequired(true);
     $bgCode->setAttrib('maxLength', 5);
     $bgCode->addValidator('NotEmpty', false, array('messages' => 'Please enter background agency code.'));
     $bgCode->addValidators(array(array('StringLength', false, array('min' => 1, 'max' => 5, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Background Agency code must contain at most %max% characters.', Zend_Validate_StringLength::TOO_SHORT => 'Background Agency code must contain at least %min% characters.')))));
     $bgCode->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[A-Za-z][a-zA-Z@\\-]*$/', 'messages' => array(Zend_Validate_Regex::NOT_MATCH => 'Please enter valid background agency code.')))));
     // Vendors Code
     $vendorsCode = new Zend_Form_Element_Text('vendor_code');
     $vendorsCode->addFilter(new Zend_Filter_StringTrim());
     $vendorsCode->setAttrib('maxLength', 5);
     $vendorsCode->setRequired(true);
     $vendorsCode->addValidator('NotEmpty', false, array('messages' => 'Please enter vendor code.'));
     $vendorsCode->addValidators(array(array('StringLength', false, array('min' => 1, 'max' => 5, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Vendor code must contain at most %max% characters.', Zend_Validate_StringLength::TOO_SHORT => 'Vendor code must contain at least %min% characters.')))));
     $vendorsCode->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[A-Za-z][a-zA-Z@\\-]*$/', 'messages' => array(Zend_Validate_Regex::NOT_MATCH => 'Please enter valid vendor code.')))));
     // Staffing Code
     $staffingCode = new Zend_Form_Element_Text('staffing_code');
     $staffingCode->setAttrib('maxLength', 5);
     $staffingCode->addFilter(new Zend_Filter_StringTrim());
     $staffingCode->setRequired(true);
     $staffingCode->addValidator('NotEmpty', false, array('messages' => 'Please enter staffing code.'));
     $staffingCode->addValidators(array(array('StringLength', false, array('min' => 1, 'max' => 5, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Staffing code must contain at most %max% characters.', Zend_Validate_StringLength::TOO_SHORT => 'Staffing code must contain at least %min% characters.')))));
     $staffingCode->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[A-Za-z][a-zA-Z@\\-]*$/', 'messages' => array(Zend_Validate_Regex::NOT_MATCH => 'Please enter valid staffing code.')))));
     $users_code = new Zend_Form_Element_Text('users_code');
     $users_code->setAttrib('maxLength', 5);
     $users_code->addFilter(new Zend_Filter_StringTrim());
     $users_code->setRequired(true);
     $users_code->addValidator('NotEmpty', false, array('messages' => 'Please enter users code.'));
     $users_code->addValidators(array(array('StringLength', false, array('min' => 1, 'max' => 5, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Users code must contain at most %max% characters.', Zend_Validate_StringLength::TOO_SHORT => 'Users code must contain at least %min% characters.')))));
     $users_code->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[A-Za-z][a-zA-Z@\\-]*$/', 'messages' => array(Zend_Validate_Regex::NOT_MATCH => 'Please enter valid users code.')))));
     $requisition_code = new Zend_Form_Element_Text('requisition_code');
     $requisition_code->setAttrib('maxLength', 5);
     $requisition_code->addFilter(new Zend_Filter_StringTrim());
     $requisition_code->setRequired(true);
     $requisition_code->addValidator('NotEmpty', false, array('messages' => 'Please enter requisition code.'));
     $requisition_code->addValidators(array(array('StringLength', false, array('min' => 1, 'max' => 5, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Requisition code must contain at most %max% characters.', Zend_Validate_StringLength::TOO_SHORT => 'Requisition code must contain at least %min% characters.')))));
     $requisition_code->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[A-Za-z][a-zA-Z@\\-]*$/', 'messages' => array(Zend_Validate_Regex::NOT_MATCH => 'Please enter valid requisition code.')))));
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Save');
     $this->addElements(array($id, $empCode, $bgCode, $vendorsCode, $staffingCode, $submit, $users_code, $requisition_code));
     $this->setElementDecorators(array('ViewHelper'));
 }
コード例 #3
0
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'workeligibilitydetails');
     $id = new Zend_Form_Element_Hidden('id');
     $userid = new Zend_Form_Element_Hidden('user_id');
     $emptyflag = new Zend_Form_Element_Hidden('emptyFlag');
     $issuingauthflag = new Zend_Form_Element_Hidden('issuingauthflag');
     //Document type Id....
     $docType = new Zend_Form_Element_Select('documenttype_id');
     $docType->setRegisterInArrayValidator(false);
     $docType->setAttrib('onchange', 'checkissuingauthority(this)');
     $docType->addMultiOption('', 'Select Document Type');
     //Document Issue Date...
     $doc_issue_date = new ZendX_JQuery_Form_Element_DatePicker('doc_issue_date');
     $doc_issue_date->setOptions(array('class' => 'brdr_none'));
     $doc_issue_date->setAttrib('readonly', 'true');
     $doc_issue_date->setAttrib('onfocus', 'this.blur()');
     // Document Expiry Date...
     $doc_expiry_date = new ZendX_JQuery_Form_Element_DatePicker('doc_expiry_date');
     $doc_expiry_date->setAttrib('readonly', 'true');
     $doc_expiry_date->setAttrib('onfocus', 'this.blur()');
     $doc_expiry_date->setOptions(array('class' => 'brdr_none'));
     // Expiration Date should be greater than today's date...
     // issuing authority name...
     $issueAuth_name = new Zend_Form_Element_Text('issuingauth_name');
     $issueAuth_name->setAttrib('maxLength', 50);
     $issueAuth_name->addFilter(new Zend_Filter_StringTrim());
     $issueAuth_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 name.')))));
     //issuing authority country.....
     $country = new Zend_Form_Element_Select('issuingauth_country');
     $country->setAttrib('onchange', 'displayParticularState(this,"","issuingauth_state","")');
     $country->setRegisterInArrayValidator(false);
     //issuing authority state.....
     $state = new Zend_Form_Element_Select('issuingauth_state');
     $state->setAttrib('onchange', 'displayParticularCity(this,"","issuingauth_city","")');
     $state->setRegisterInArrayValidator(false);
     $state->addMultiOption('', 'Select State');
     //issuing authority city.....
     $city = new Zend_Form_Element_Select('issuingauth_city');
     $city->setRegisterInArrayValidator(false);
     $city->addMultiOption('', 'Select City');
     //issuing authority postal code .....
     $issuingAuth_pcode = new Zend_Form_Element_Text('issuingauth_postalcode');
     $issuingAuth_pcode->addFilter(new Zend_Filter_StringTrim());
     $issuingAuth_pcode->setAttrib("maxlength", 10);
     $issuingAuth_pcode->addValidators(array(array('StringLength', false, array('min' => 3, 'max' => 10, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Issuing authority postal code must contain at most %max% characters.', Zend_Validate_StringLength::TOO_SHORT => 'Issuing authority postal code must contain at least %min% characters.')))));
     $issuingAuth_pcode->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^(?!0{3})[0-9a-zA-Z]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid postal code.')))));
     // Form Submit .........
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Save');
     $this->addElements(array($id, $userid, $issuingauthflag, $docType, $doc_issue_date, $doc_expiry_date, $issueAuth_name, $country, $state, $city, $issuingAuth_pcode, $emptyflag, $submit));
     $this->setElementDecorators(array('ViewHelper'));
     $this->setElementDecorators(array('UiWidgetElement'), array('doc_issue_date', 'doc_expiry_date'));
 }
コード例 #4
0
ファイル: positions.php プロジェクト: uskumar33/DeltaONE
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'positions');
     $id = new Zend_Form_Element_Hidden('id');
     $emptyflag = new Zend_Form_Element_Hidden('emptyFlag');
     $positionname = new Zend_Form_Element_Text('positionname');
     $positionname->setAttrib('maxLength', 50);
     $positionname->setRequired(true);
     $positionname->addValidator('NotEmpty', false, array('messages' => 'Please enter position.'));
     $positionname->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 position.')))));
     $positionname->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_positions', 'field' => 'positionname', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive=1')));
     $positionname->getValidator('Db_NoRecordExists')->setMessage('Position already exists.');
     $jobtitleid = new Zend_Form_Element_Select('jobtitleid');
     $jobtitleid->setAttrib('class', 'selectoption');
     $jobtitleid->setRegisterInArrayValidator(false);
     $jobtitleid->addMultiOption('', 'Select Job Title');
     $jobtitleid->setRequired(true);
     $jobtitleid->addValidator('NotEmpty', false, array('messages' => 'Please select job title.'));
     $description = new Zend_Form_Element_Textarea('description');
     $description->setAttrib('rows', 10);
     $description->setAttrib('cols', 50);
     $description->setAttrib('maxlength', '200');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Save');
     $this->addElements(array($id, $positionname, $jobtitleid, $description, $emptyflag, $submit));
     $this->setElementDecorators(array('ViewHelper'));
 }
コード例 #5
0
ファイル: empskills.php プロジェクト: uskumar33/DeltaONE
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('action', DOMAIN . 'employee/add');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'empskills');
     $id = new Zend_Form_Element_Hidden('id');
     $userid = new Zend_Form_Element_Hidden('user_id');
     $skillname = new Zend_Form_Element_Text('skillname');
     $skillname->setRequired(true);
     $skillname->setAttrib('maxLength', 50);
     $skillname->addFilter('StripTags');
     $skillname->addFilter('StringTrim');
     $skillname->addValidator('NotEmpty', false, array('messages' => 'Please enter skill.'));
     $yearsofexp = new Zend_Form_Element_Text('yearsofexp');
     $yearsofexp->setAttrib('maxLength', 5);
     $yearsofexp->addFilter(new Zend_Filter_StringTrim());
     $yearsofexp->setRequired(true);
     $yearsofexp->addValidator('NotEmpty', false, array('messages' => 'Please enter years of experience.'));
     $yearsofexp->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[0-9]\\d{0,1}(\\.\\d*)?$/', 'messages' => array('regexNotMatch' => 'Please enter numbers less than 100.')))));
     $competencylevelid = new Zend_Form_Element_Select('competencylevelid');
     $competencylevelid->setRequired(true)->addErrorMessage('Please select competency level.');
     $competencylevelid->addValidator('NotEmpty', false, array('messages' => 'Please select competency level.'));
     $competencylevelid->setRegisterInArrayValidator(false);
     $year_skill = new ZendX_JQuery_Form_Element_DatePicker('year_skill_last_used');
     $year_skill->setOptions(array('class' => 'brdr_none'));
     $year_skill->setAttrib('readonly', 'true');
     $year_skill->setAttrib('onfocus', 'this.blur()');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Save');
     $this->addElements(array($id, $userid, $skillname, $yearsofexp, $competencylevelid, $year_skill, $submit));
     $this->setElementDecorators(array('ViewHelper'));
     $this->setElementDecorators(array('UiWidgetElement'), array('year_skill_last_used'));
 }
コード例 #6
0
 public function init()
 {
     // Set the method for the display form to POST
     $this->setMethod('post');
     $this->setAttribs(array('class' => 'form-horizontal'));
     $decoratorField = new My_Decorator_FieldLogin();
     $elements = array();
     // Add email field
     $input = new Zend_Form_Element_Text('email', array('required' => true, 'label' => 'Email Address:', 'id' => 'email', 'placeholder' => 'Your email..', 'class' => 'form-control', 'type' => 'email'));
     $validator = new Zend_Validate_EmailAddress();
     $validator->setOptions(array('domain' => false));
     $input->addValidators(array($validator, new Zend_Validate_NotEmpty()));
     $input->addDecorator($decoratorField);
     $elements[] = $input;
     // Add password field
     $input = new Zend_Form_Element_Password('password', array('required' => true, 'label' => 'Password:'******'id' => 'password', 'class' => 'form-control', 'placeholder' => 'Your password..'));
     $input->addValidators(array(new Zend_Validate_NotEmpty()));
     $input->addDecorator($decoratorField);
     $elements[] = $input;
     // Add checkbox field
     $input = new Zend_Form_Element_Checkbox('rememberMe', array('label' => 'Remember me', 'id' => 'rememberMe', 'class' => 'checkbox', 'type' => 'checkbox'));
     $decoratorCheckBox = new My_Decorator_CheckBox();
     $input->addDecorator($decoratorCheckBox);
     $elements[] = $input;
     $input = new Zend_Form_Element('resetpass', array('label' => 'Reset your password', 'id' => 'resetpass', 'class' => 'form-control', 'value' => 'resetpass'));
     $input->addDecorator(new My_Decorator_AnchoraForm());
     $elements[] = $input;
     //Add Submit button
     $input = new Zend_Form_Element_Submit('submit', array('Label' => '', 'class' => 'btn btn-default', 'value' => 'Login'));
     $input->addDecorator($decoratorField);
     $elements[] = $input;
     $this->addElements($elements);
     $this->addDisplayGroup(array('email', 'password', 'resetpass', 'rememberMe', 'submit'), 'displgrp', array('decorators' => array('FormElements', 'Fieldset')));
 }
コード例 #7
0
ファイル: states.php プロジェクト: uskumar33/DeltaONE
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('action', DOMAIN . 'states/edit');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'states');
     $id = new Zend_Form_Element_Hidden('id');
     $country = new Zend_Form_Element_Select('countryid');
     $country->setAttrib('class', 'selectoption');
     $country->setAttrib('onchange', 'displayParticularState(this,"otheroption","state","")');
     $country->setRegisterInArrayValidator(false);
     $country->addMultiOption('', 'Select Country');
     $country->setRequired(true);
     $country->addValidator('NotEmpty', false, array('messages' => 'Please select country.'));
     $state = new Zend_Form_Element_Multiselect('state');
     $state->setAttrib('onchange', 'displayStateCode(this)');
     $state->setRegisterInArrayValidator(false);
     $state->setRequired(true);
     $state->addValidator('NotEmpty', false, array('messages' => 'Please select state.'));
     $state->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_states', 'field' => 'state_id_org', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive=1')));
     $state->getValidator('Db_NoRecordExists')->setMessage('State already exists.');
     $otherstatename = new Zend_Form_Element_Text('otherstatename');
     $otherstatename->setAttrib('maxLength', 20);
     $otherstatename->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[^ ][a-zA-Z\\s]*$/i', 'messages' => array('regexNotMatch' => 'Please enter valid state name.')))));
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Save');
     $this->addElements(array($id, $country, $state, $otherstatename, $submit));
     $this->setElementDecorators(array('ViewHelper'));
 }
コード例 #8
0
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('class', 'col-md-9');
     $decoratorField = new My_Decorator_Field();
     $elements = array();
     //render our form elements and the "form" tag
     $this->setDecorators(array('FormElements', 'Form'));
     $this->setElementDecorators(array('ViewHelper', 'Label'));
     // Add Quantity field
     $input = new Zend_Form_Element_Text('quantity', array('required' => true, 'class' => '"col-md-6"', 'min' => self::MIN, 'max' => self::MAX, 'step' => '1', 'type' => 'number'));
     $min = new Zend_Validate_LessThan(self::MAX + 1);
     $max = new Zend_Validate_GreaterThan(self::MIN);
     $input->addValidators(array(new Zend_Validate_Float(), $min, $max, new Zend_Validate_NotEmpty()));
     $input->addDecorator($decoratorField);
     $elements[] = $input;
     //Add id hidden field
     $input = new Zend_Form_Element_Hidden('product_id');
     $min = new Zend_Validate_GreaterThan(self::MIN);
     $input->addValidators(array(new Zend_Validate_Digits(), $min, new Zend_Validate_NotEmpty()));
     $input->removeDecorator('HtmlTag');
     $input->removeDecorator('Label');
     $elements[] = $input;
     $this->addElements($elements);
 }
コード例 #9
0
ファイル: veteranstatus.php プロジェクト: rajbrt/sentrifugo
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('action', BASE_URL . 'veteranstatus/edit');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'veteranstatus');
     $id = new Zend_Form_Element_Hidden('id');
     $veteranstatus = new Zend_Form_Element_Text('veteranstatus');
     $veteranstatus->setAttrib('maxLength', 20);
     $veteranstatus->setRequired(true);
     $veteranstatus->addValidator('NotEmpty', false, array('messages' => 'Please enter veteran status.'));
     $veteranstatus->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^(?=.*[a-zA-Z])([^ ][a-zA-Z\\s]*)$/', 'messages' => array('regexNotMatch' => 'Please enter valid veteran status.')))));
     $veteranstatus->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_veteranstatus', 'field' => 'veteranstatus', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive=1')));
     $veteranstatus->getValidator('Db_NoRecordExists')->setMessage('Veteran status already exists.');
     $description = new Zend_Form_Element_Textarea('description');
     $description->setAttrib('rows', 10);
     $description->setAttrib('cols', 50);
     $description->setAttrib('maxlength', '200');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Save');
     $url = "'gender/saveupdate/format/json'";
     $dialogMsg = "''";
     $toggleDivId = "''";
     $jsFunction = "'redirecttocontroller(\\'gender\\');'";
     $this->addElements(array($id, $veteranstatus, $description, $submit));
     $this->setElementDecorators(array('ViewHelper'));
 }
コード例 #10
0
 public function init()
 {
     $this->setMethod(Zend_Form::METHOD_POST);
     $this->addDecorators(array("ViewHelper"), array("Errors"));
     $firstname = new Zend_Form_Element_Text("first_name");
     $firstname->setLabel("Firstname");
     $firstname->setRequired(true);
     $firstname->class = "span4";
     $firstname->addValidators(array(array("validator" => "NotEmpty", "breakChainOnFailure" => true), array("validator" => "alpha", "options" => array("allowWhiteSpace" => false)), array("validator" => "stringLength", "options" => array(6, 50))));
     $lastname = new Zend_Form_Element_Text("last_name");
     $lastname->setLabel("Lastname");
     $lastname->setRequired(true);
     $lastname->class = "span4";
     $lastname->addValidators(array(array("validator" => "NotEmpty", "breakChainOnFailure" => true), array("validator" => "alpha", "options" => array("allowWhiteSpace" => false)), array("validator" => "stringLength", "options" => array(6, 50))));
     $email = new Zend_Form_Element_Text("email");
     $email->setLabel("Email Address");
     $email->setRequired(true);
     $email->class = "span4";
     $email->addValidators(array(array("validator" => "NotEmpty", "breakChainOnFailure" => true)), array("validator" => "emailAddress"), array("validator" => "stringLength", "options" => array(6, 50)));
     $confirm_email = new Zend_Form_Element_Text("confirm_email");
     $confirm_email->setLabel("Confirm Email Address");
     $confirm_email->setRequired(true);
     $confirm_email->class = "span4";
     $confirm_email->addValidators(array(array("validator" => "NotEmpty", "breakChainOnFailure" => true)), array("validator" => "emailAddress"), array("validator" => "stringLength", "options" => array(6, 50)));
     $this->addElements(array($firstname, $lastname, $email, $confirm_email));
 }
コード例 #11
0
ファイル: Savings.php プロジェクト: maniargaurav/OurBank
 public function __construct($minimumDeposit)
 {
     parent::__construct($minimumDeposit);
     $savings_amount = new Zend_Form_Element_Text('savings_amount');
     $savings_amount->addValidators(array(array('Float'), array('GreaterThan', false, array($minimumDeposit - 0.0001, 'messages' => array('notGreaterThan' => 'Minimum 
                                          Amount To open a savings account =' . $minimumDeposit)))));
     $savings_amount->setAttrib('class', 'txt_put');
     $savings_amount->setAttrib('id', 'amount');
     $savings_amount->setRequired(true);
     $savings_amount->setAttrib('onchange', 'calculateTotalAmount(this.value)');
     $memberfirstname = new Zend_Form_Element_MultiCheckbox('memberfirstname');
     $memberfirstname->setAttrib('class', 'textfield');
     $memberfirstname->setAttrib('id', 'selector');
     //         $memberfirstname->setRequired(true);
     $date1 = new ZendX_JQuery_Form_Element_DatePicker('date1', array('label' => 'Date:'));
     $date1->setAttrib('class', 'txt_put');
     $date1->setJQueryParam('dateFormat', 'yy-mm-dd');
     $date1->setRequired(true);
     $memberId = new Zend_Form_Element_Hidden('memberId');
     $Type = new Zend_Form_Element_Hidden('Type');
     $productId = new Zend_Form_Element_Hidden('productId');
     $typeId = new Zend_Form_Element_Hidden('typeId');
     $memberTypeIdv = new Zend_Form_Element_Hidden('memberTypeIdv');
     $submit = new Zend_Form_Element_Submit('Submit');
     $Yes = new Zend_Form_Element_Submit('Yes');
     $back = new Zend_Form_Element_Submit('Back');
     $this->addElements(array($submit, $savings_amount, $memberfirstname, $memberId, $date1, $productId, $typeId, $Type, $memberTypeIdv, $back, $Yes));
 }
コード例 #12
0
 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'));
 }
コード例 #13
0
ファイル: empjobhistory.php プロジェクト: rajbrt/sentrifugo
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'empjobhistory');
     $id = new Zend_Form_Element_Hidden('id');
     $userid = new Zend_Form_Element_Hidden('user_id');
     $positionheld = new Zend_Form_Element_Select('positionheld');
     $positionheld->setLabel('Position');
     $positionheld->setRegisterInArrayValidator(false);
     // $positionheld->setRequired(true);
     // $positionheld->addValidator('NotEmpty', false, array('messages' => 'Please select position.'));
     $department = new Zend_Form_Element_Select('department');
     $department->setLabel('Department');
     $department->setRegisterInArrayValidator(false);
     // $department->setRequired(true);
     // $department->addValidator('NotEmpty', false, array('messages' => 'Please select department.'));
     $jobtitleid = new Zend_Form_Element_Select('jobtitleid');
     $jobtitleid->setLabel('Job Title');
     $jobtitleid->setRegisterInArrayValidator(false);
     // $jobtitleid->setRequired(true);
     // $jobtitleid->addValidator('NotEmpty', false, array('messages' => 'Please select job title.'));
     $start_date = new ZendX_JQuery_Form_Element_DatePicker('start_date');
     $start_date->setLabel('From');
     $start_date->setOptions(array('class' => 'brdr_none'));
     $start_date->setAttrib('readonly', 'true');
     $start_date->setAttrib('onfocus', 'this.blur()');
     $start_date->setRequired(true);
     $start_date->addValidator('NotEmpty', false, array('messages' => 'Please enter start date.'));
     $end_date = new ZendX_JQuery_Form_Element_DatePicker('end_date');
     $end_date->setLabel('To');
     $end_date->setOptions(array('class' => 'brdr_none'));
     $end_date->setAttrib('readonly', 'true');
     $end_date->setAttrib('onfocus', 'this.blur()');
     $received_amount = new Zend_Form_Element_Text("received_amount");
     $received_amount->setLabel("Amount Received");
     $received_amount->setAttrib('maxLength', 10);
     $received_amount->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[0-9\\.]*$/', 'messages' => array('regexNotMatch' => 'Please enter only numbers.')))));
     $paid_amount = new Zend_Form_Element_Text("paid_amount");
     $paid_amount->setLabel("Amount Paid");
     $paid_amount->setAttrib('maxLength', 10);
     $paid_amount->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[0-9\\.]*$/', 'messages' => array('regexNotMatch' => 'Please enter only numbers.')))));
     $client = new Zend_Form_Element_Select('client');
     $client->setLabel('Client');
     $client->setRegisterInArrayValidator(false);
     $client->setRequired(true);
     $client->addValidator('NotEmpty', false, array('messages' => 'Please select a client.'));
     $vendor = new Zend_Form_Element_Text("vendor");
     $vendor->setLabel("Vendor");
     $vendor->addValidator("regex", true, array('pattern' => '/^[a-zA-Z.&\\- ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter a valid vendor name.')));
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Save');
     $this->addElements(array($id, $userid, $positionheld, $jobtitleid, $department, $start_date, $end_date, $received_amount, $paid_amount, $client, $vendor, $submit));
     $this->setElementDecorators(array('ViewHelper'));
     $this->setElementDecorators(array('UiWidgetElement'), array('start_date', 'end_date'));
 }
コード例 #14
0
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'educationdetails');
     $this->setAttrib('action', DOMAIN . 'educationdetails/addpopup/');
     $id = new Zend_Form_Element_Hidden('id');
     $user_id = new Zend_Form_Element_Hidden('user_id');
     $educationlevel = new Zend_Form_Element_Select('educationlevel');
     $educationlevel->setLabel("Education Level");
     $educationlevel->setRegisterInArrayValidator(false);
     $educationlevel->setRequired(true);
     $educationlevel->addValidator('NotEmpty', false, array('messages' => 'Please select educational level.'));
     //institution_name ...
     $institution_name = new Zend_Form_Element_Text('institution_name');
     $institution_name->addFilter(new Zend_Filter_StringTrim());
     $institution_name->setRequired(true);
     $institution_name->setAttrib("maxlength", 50);
     $institution_name->addValidator('NotEmpty', false, array('messages' => 'Please enter institution name.'));
     $institution_name->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z\\s]+$/i', 'messages' => array('regexNotMatch' => 'Please enter only alphabets.')))));
     //course ...
     $course = new Zend_Form_Element_Text('course');
     $course->addFilter(new Zend_Filter_StringTrim());
     $course->setRequired(true);
     $course->setAttrib("maxlength", 50);
     $course->addValidator('NotEmpty', false, array('messages' => 'Please enter course name.'));
     $course->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z0-9\\-\\.\\s]+$/i', 'messages' => array('regexNotMatch' => 'Please enter valid course name.')))));
     //from_date..
     $from_date = new ZendX_JQuery_Form_Element_DatePicker('from_date');
     $from_date->setOptions(array('class' => 'brdr_none'));
     $from_date->setRequired(true);
     $from_date->setAttrib('readonly', 'true');
     $from_date->setAttrib('onfocus', 'this.blur()');
     $from_date->addValidator('NotEmpty', false, array('messages' => 'Please select from date.'));
     //to_date
     $to_date = new ZendX_JQuery_Form_Element_DatePicker('to_date');
     $to_date->setOptions(array('class' => 'brdr_none'));
     $to_date->setRequired(true);
     $to_date->setAttrib('readonly', 'true');
     $to_date->setAttrib('onfocus', 'this.blur()');
     $to_date->addValidator('NotEmpty', false, array('messages' => 'Please select to date.'));
     // percentage...
     $percentage = new Zend_Form_Element_Text('percentage');
     $percentage->addFilter(new Zend_Filter_StringTrim());
     $percentage->setRequired(true);
     $percentage->setAttrib("maxlength", 2);
     $percentage->addValidator('NotEmpty', false, array('messages' => 'Please enter percentage.'));
     $percentage->addValidator("regex", true, array('pattern' => '/^[0-9]+$/', 'messages' => array('regexNotMatch' => 'Please enter only numbers.')));
     //Form Submit....
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Save');
     $this->addElements(array($id, $user_id, $educationlevel, $from_date, $to_date, $percentage, $course, $institution_name, $submit));
     $this->setElementDecorators(array('ViewHelper'));
     $this->setElementDecorators(array('UiWidgetElement'), array('from_date', 'to_date'));
 }
コード例 #15
0
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'trainingandcertificationdetails');
     $id = new Zend_Form_Element_Hidden('id');
     $user_id = new Zend_Form_Element_Hidden('user_id');
     //course_name ...
     $course_name = new Zend_Form_Element_Text('course_name');
     $course_name->addFilter(new Zend_Filter_StringTrim());
     $course_name->setRequired(true);
     $course_name->setAttrib('maxLength', 50);
     $course_name->addValidator('NotEmpty', false, array('messages' => 'Please enter course name.'));
     $course_name->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z0-9\\-\\s]+$/i', 'messages' => array('regexNotMatch' => 'Please enter valid course name.')))));
     // course_level...
     $course_level = new Zend_Form_Element_Text('course_level');
     $course_level->addFilter(new Zend_Filter_StringTrim());
     $course_level->setRequired(true);
     $course_level->setAttrib('maxLength', 50);
     $course_level->addValidator('NotEmpty', false, array('messages' => 'Please enter course level.'));
     $course_level->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z0-9\\.\\-\\s]+$/i', 'messages' => array('regexNotMatch' => 'Please enter valid course level.')))));
     //issued_date
     $issued_date = new ZendX_JQuery_Form_Element_DatePicker('issued_date');
     $issued_date->setOptions(array('class' => 'brdr_none'));
     $issued_date->setAttrib('readonly', 'true');
     $issued_date->setAttrib('onfocus', 'this.blur()');
     // description ....
     $description = new Zend_Form_Element_Textarea('description');
     $description->setAttrib('rows', 10);
     $description->setAttrib('cols', 50);
     //course_offered_by ....
     $course_offered_by = new Zend_Form_Element_Text('course_offered_by');
     $course_offered_by->addFilter(new Zend_Filter_StringTrim());
     $course_offered_by->setRequired(true);
     $course_offered_by->setAttrib('maxLength', 50);
     $course_offered_by->addValidator('NotEmpty', false, array('messages' => 'Please enter course offered by.'));
     $course_offered_by->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z0-9\\-\\s]+$/i', 'messages' => array('regexNotMatch' => 'Please enter valid name.')))));
     //Referer mobile number ....
     $certification_name = new Zend_Form_Element_Text('certification_name');
     $certification_name->addFilter(new Zend_Filter_StringTrim());
     $certification_name->setAttrib('maxLength', 50);
     $certification_name->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-z0-9\\-\\#\\.\\s]+$/i', 'messages' => array('regexNotMatch' => 'Please enter valid certification name.')))));
     $certificationNameStr = Zend_Controller_Front::getInstance()->getRequest()->getParam('certification_name', null);
     //If certification is done then should enter the issue date......
     if ($certificationNameStr != "") {
         $issued_date->setRequired(true);
         $issued_date->addValidator('NotEmpty', false, array('messages' => 'Please select date.'));
     }
     //Form Submit....
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Save');
     $this->addElements(array($id, $user_id, $certification_name, $course_offered_by, $description, $issued_date, $course_level, $course_name, $submit));
     $this->setElementDecorators(array('ViewHelper'));
     $this->setElementDecorators(array('UiWidgetElement'), array('issued_date'));
 }
コード例 #16
0
 public function init()
 {
     $this->addDecorators(array("ViewHelper"), array("Errors"));
     $emailAddress = new Zend_Form_Element_Text("email_address");
     $emailAddress->setLabel("Email address");
     $emailAddress->setRequired(true);
     $emailAddress->addValidators(array(array("validator" => "NotEmpty", "breakChainOnFailure" => true)), array("validator" => "emailAddress"), array("validator" => "stringLength", "options" => array(6, 50)));
     $this->setMethod(Zend_Form::METHOD_POST);
     $this->addElement($emailAddress);
 }
コード例 #17
0
ファイル: Roles.php プロジェクト: samdubey/sentrifugo
 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'));
 }
コード例 #18
0
 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'));
 }
コード例 #19
0
ファイル: Dropdown.php プロジェクト: maniargaurav/OurBank
 public function init()
 {
     $text_value = new Zend_Form_Element_Text('textvalue');
     $text_value->setAttrib('class', 'txt_put');
     $text_value->addValidators(array(array('NotEmpty')))->setRequired(true);
     $name = new Zend_Form_Element_Text('name');
     $name->setAttrib('class', 'txt_put');
     $name->addValidators(array(array('NotEmpty')))->setRequired(true);
     $table_name = new Zend_Form_Element_Hidden('table_name');
     $id = new Zend_Form_Element_Hidden('id');
     $attr = new Zend_Form_Element_Hidden('attr');
     $submit = new Zend_Form_Element_Submit('Add');
     $this->addElements(array($text_value, $table_name, $id, $attr, $name, $submit));
 }
コード例 #20
0
ファイル: jobtitles.php プロジェクト: uskumar33/DeltaONE
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('action', DOMAIN . 'jobtitles/edit');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'jobtitles');
     $id = new Zend_Form_Element_Hidden('id');
     $emptyflag = new Zend_Form_Element_Hidden('emptyFlag');
     $jobtitlecode = new Zend_Form_Element_Text('jobtitlecode');
     $jobtitlecode->setAttrib('maxLength', 20);
     $jobtitlecode->setRequired(true);
     $jobtitlecode->addValidator('NotEmpty', false, array('messages' => 'Please enter job title code.'));
     $jobtitlecode->addValidator("regex", true, array('pattern' => '/^[a-zA-Z][a-zA-Z0-9\\s]*$/', 'messages' => array('regexNotMatch' => 'Please enter valid job title code.')));
     $jobtitlecode->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_jobtitles', 'field' => 'jobtitlecode', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive=1')));
     $jobtitlecode->getValidator('Db_NoRecordExists')->setMessage('Job title code already exists.');
     $jobtitlename = new Zend_Form_Element_Text('jobtitlename');
     $jobtitlename->setAttrib('maxLength', 50);
     $jobtitlename->setRequired(true);
     $jobtitlename->addValidator('NotEmpty', false, array('messages' => 'Please enter job title.'));
     $jobtitlename->addValidator("regex", true, array('pattern' => '/^[a-zA-Z][a-zA-Z0-9\\-\\&\\s]*$/', 'messages' => array('regexNotMatch' => 'Please enter valid job title.')));
     $jobdescription = new Zend_Form_Element_Textarea('jobdescription');
     $jobdescription->setAttrib('rows', 10);
     $jobdescription->setAttrib('cols', 50);
     $jobdescription->setAttrib('maxlength', '200');
     $minexperiencerequired = new Zend_Form_Element_Text('minexperiencerequired');
     $minexperiencerequired->setAttrib('maxLength', 4);
     $minexperiencerequired->addFilter(new Zend_Filter_StringTrim());
     $minexperiencerequired->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[0-9]\\d{0,1}(\\.\\d*)?$/', 'messages' => array('regexNotMatch' => 'Please enter only numeric characters.')))));
     $jobpaygradecode = new Zend_Form_Element_Text('jobpaygradecode');
     $jobpaygradecode->setAttrib('maxLength', 20);
     $jobpaygradecode->addFilter(new Zend_Filter_StringTrim());
     $jobpaygradecode->setRequired(true);
     $jobpaygradecode->addValidator('NotEmpty', false, array('messages' => 'Please enter job pay grade code.'));
     $jobpayfrequency = new Zend_Form_Element_Select('jobpayfrequency');
     $jobpayfrequency->setLabel('Job pay frequency');
     $jobpayfrequency->addMultiOption('', 'Select Pay Frequency');
     $jobpayfrequency->setRequired(true);
     $jobpayfrequency->addValidator('NotEmpty', false, array('messages' => 'Please select job pay frequency.'));
     $jobpayfrequency->setRegisterInArrayValidator(false);
     $comments = new Zend_Form_Element_Textarea('comments');
     $comments->setAttrib('rows', 10);
     $comments->setAttrib('cols', 50);
     $comments->setAttrib('maxlength', '200');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Save');
     $this->addElements(array($id, $jobtitlecode, $jobtitlename, $jobdescription, $minexperiencerequired, $emptyflag, $jobpaygradecode, $jobpayfrequency, $comments, $submit));
     $this->setElementDecorators(array('ViewHelper'));
 }
コード例 #21
0
ファイル: Login.php プロジェクト: redhattaccoss/Leadschat
 public function init()
 {
     $this->addDecorators(array("ViewHelper"), array("Errors"));
     $username = new Zend_Form_Element_Text("username");
     $username->setRequired(true);
     $username->setLabel("Username");
     $username->addValidators(array(array("validator" => "NotEmpty")), array("validator" => "alpha", "options" => array("allowWhiteSpace" => false)), array("validator" => "stringLength", "options" => array(6, 30)));
     $password = new Zend_Form_Element_Password("password");
     $password->setRequired(true);
     $password->setLabel("Password");
     $password->addValidators(array(array("validator" => "NotEmpty")), array("validator" => "alnum", "options" => array("allowWhiteSpace" => false)), array("validator" => "stringLength", "options" => array(6, 30)));
     $rememberMe = new Zend_Form_Element_Checkbox("remember_me");
     $this->setMethod(Zend_Form::METHOD_POST);
     $this->addElements(array($username, $password, $rememberMe));
 }
コード例 #22
0
ファイル: Recurring.php プロジェクト: maniargaurav/OurBank
 public function __construct($path, $minumumbal, $maximumbal)
 {
     parent::__construct($path, $minumumbal);
     $date1 = new ZendX_JQuery_Form_Element_DatePicker('date1');
     $date1->setAttrib('class', 'txt_put');
     $date1->setAttrib('autocomplete', 'off');
     $date1->setJQueryParam('dateFormat', 'yy-mm-dd');
     $date1->setRequired(true);
     $period = new Zend_Form_Element_Select('period');
     $period->addMultiOption('', 'Select...');
     $period->setAttrib('class', 'txt_put');
     $period->setRequired(true);
     $period->setAttrib('onchange', 'getInterests("' . $path . '",this.value)');
     $interest = new Zend_Form_Element_Text('interest');
     $interest->setAttrib('class', 'txt_put');
     //         $interest->setAttrib('readonly', 'true');
     $tAmount = new Zend_Form_Element_Text('tAmount');
     $tAmount->setAttrib('class', 'txt_put');
     $tAmount->setAttrib('onchange', 'calculateMatureAmount()');
     $valid = new Zend_Validate_Between(array('min' => $minumumbal, 'max' => $maximumbal));
     $tAmount->addValidators(array(array($valid, true)));
     $matureamount = new Zend_Form_Element_Text('matureamount');
     $matureamount->setAttrib('class', 'txt_put');
     $amount = new Zend_Form_Element_Text('amount');
     $amount->setAttrib('class', 'txt_put');
     //         $amount->setRequired(true);
     $amount->setAttrib('onchange', 'calculateTotalAmount(this.value),calculateMatureAmount()');
     $memberfirstname = new Zend_Form_Element_MultiCheckbox('memberfirstname');
     $memberfirstname->setAttrib('class', 'textfield');
     //         $memberfirstname->setRequired(true);
     $fixedfee = new Zend_Form_Element_Text('fixedfee');
     $fixedfee->setAttrib('class', 'txt_put');
     $fixedfee->setAttrib('readonly', 'true');
     $totalamount = new Zend_Form_Element_Text('totalamount');
     $totalamount->setAttrib('class', 'txt_put');
     $totalamount->setAttrib('readonly', 'true');
     $memberId = new Zend_Form_Element_Hidden('memberId');
     $productId = new Zend_Form_Element_Hidden('Id');
     $membercode = new Zend_Form_Element_Hidden('code');
     $typeId = new Zend_Form_Element_Hidden('typeId');
     $Type = new Zend_Form_Element_Hidden('Type');
     $memberTypeIdv = new Zend_Form_Element_Hidden('memberTypeIdv');
     $submit = new Zend_Form_Element_Submit('Submit');
     $submit->setRequired(false);
     $Yes = new Zend_Form_Element_Submit('Yes');
     $back = new Zend_Form_Element_Submit('Back');
     $this->addElements(array($submit, $amount, $period, $matureamount, $interest, $tAmount, $memberfirstname, $fixedfee, $memberId, $membercode, $totalamount, $Type, $date1, $productId, $typeId, $memberTypeIdv, $Yes, $back));
 }
コード例 #23
0
ファイル: Form.php プロジェクト: BGCX262/zx-zf-hg-to-git
 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;
 }
コード例 #24
0
 public function init()
 {
     // Set the method for the display form to POST
     $this->setMethod('post');
     $this->setAttribs(array('class' => 'form-horizontal'));
     $decoratorField = new My_Decorator_Field();
     $elements = array();
     // Add name field
     $input = new Zend_Form_Element_Text('host', array('required' => true, 'label' => 'SMTP Host:', 'id' => 'host', 'placeholder' => 'Type something..', 'class' => 'form-control', 'value' => 'smtp.gmail.com'));
     $input->addValidators(array(new Zend_Validate_NotEmpty()));
     $input->addDecorator($decoratorField);
     $elements[] = $input;
     // Add category field
     $select = new Zend_Form_Element_Select('stype', array('required' => true, 'label' => 'Security:', 'id' => 'stype', 'class' => 'form-control'));
     $select->addMultiOption('TLS', 'TLS');
     $select->addMultiOption('SSH', 'SSH');
     $select->setValue('TLS');
     $select->addDecorator($decoratorField);
     $elements[] = $select;
     // Add Price field
     $input = new Zend_Form_Element_Text('port', array('required' => true, 'label' => 'Port:', 'id' => 'port', 'placeholder' => 'Type something..', 'class' => 'form-control', 'min' => 0, 'step' => '1', 'type' => 'number', 'value' => '587'));
     $min = new Zend_Validate_GreaterThan(0);
     $input->addValidators(array(new Zend_Validate_Digits(), $min, new Zend_Validate_NotEmpty()));
     $input->addDecorator($decoratorField);
     $elements[] = $input;
     $input = new Zend_Form_Element_Text('email', array('required' => true, 'label' => 'SMTP Email Address:', 'id' => 'email', 'placeholder' => 'Your email..', 'class' => 'form-control', 'type' => 'email', 'value' => '*****@*****.**'));
     $input->addValidators(array(new Zend_Validate_EmailAddress(), new Zend_Validate_NotEmpty()));
     $input->addDecorator($decoratorField);
     $elements[] = $input;
     // Add category field
     $input = new Zend_Form_Element_Password('password1', array('required' => true, 'label' => 'Password:'******'id' => 'password1', 'class' => 'form-control', 'placeholder' => 'Your SMTP password..'));
     $input->addValidators(array(new Zend_Validate_NotEmpty()));
     $input->addDecorator($decoratorField);
     $elements[] = $input;
     // Add category field
     $input = new Zend_Form_Element_Password('password2', array('required' => true, 'label' => 'Password Again:', 'id' => 'password2', 'class' => 'form-control', 'placeholder' => 'Your SMTP password again..', 'validators' => array(array('identical', false, array('token' => 'password1')))));
     $input->addDecorator($decoratorField);
     $elements[] = $input;
     //Add Submit button
     $input = new Zend_Form_Element_Submit('submit', array('Label' => ' ', 'class' => 'btn btn-info', 'value' => 'Add New Configuration'));
     $input->addDecorator($decoratorField);
     $elements[] = $input;
     $this->addElements($elements);
     $this->addDisplayGroup(array('host', 'stype', 'port', 'email', 'password1', 'password2', 'submit'), 'displgrp', array('legend' => 'Add Products', 'decorators' => array('FormElements', 'Fieldset')));
     return $this;
 }
コード例 #25
0
 public function __construct($options = null)
 {
     parent::__construct($options);
     $this->setName('serverSettings');
     $server_name = new Zend_Form_Element_Text('name');
     $server_name->setLabel(_r('Name'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim');
     $not_empty = new Zend_Validate_NotEmpty();
     $not_empty->setMessage(_r('Please enter the Server Name'));
     $server_name->addValidators(array($not_empty));
     $hostname = new Zend_Form_Element_Text('hostname');
     $hostname->setLabel(_r('Hostname'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim');
     $not_empty = new Zend_Validate_NotEmpty();
     $not_empty->setMessage(_r('Please enter the Hostname'));
     $hostname->addValidators(array($not_empty));
     $ct_map = new GD_Model_ConnectionTypesMapper();
     $connection_types = $ct_map->fetchAll();
     $connection_type_id = new Zend_Form_Element_Select('connectionTypeId');
     $connection_type_id->setLabel(_r('Connection Type'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim');
     $not_empty = new Zend_Validate_NotEmpty();
     $not_empty->setMessage(_r('Please choose a Connection Type'));
     $connection_type_id->addValidators(array($not_empty));
     foreach ($connection_types as $connection_type) {
         $connection_type_id->addMultiOption($connection_type->getId(), $connection_type->getName());
     }
     $port = new Zend_Form_Element_Text('port');
     $port->setLabel(_r('Port'))->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim');
     $not_empty = new Zend_Validate_NotEmpty();
     $not_empty->setMessage(_r('Please enter the Port Number'));
     $port->addValidators(array($not_empty));
     $username = new Zend_Form_Element_Text('username');
     $username->setLabel(_r('Username'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('autocomplete', 'off');
     $not_empty = new Zend_Validate_NotEmpty();
     $not_empty->setMessage(_r('Please enter the Username'));
     $username->addValidators(array($not_empty));
     $password = new Zend_Form_Element_Password('password');
     $password->setLabel('Password')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('autocomplete', 'off')->setAttrib('renderPassword', true);
     $not_empty = new Zend_Validate_NotEmpty();
     $not_empty->setMessage(_r('Please enter the Password'));
     $password->addValidators(array($not_empty));
     $report_path = new Zend_Form_Element_Text('remotePath');
     $report_path->setLabel(_r('Remote Path'))->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim');
     $submit = new Zend_Form_Element_Image('btn_submit');
     $submit->setImage('/images/buttons/small/save-changes.png');
     $this->addElements(array($server_name, $hostname, $connection_type_id, $port, $username, $password, $report_path, $submit));
 }
コード例 #26
0
ファイル: geographygroup.php プロジェクト: rajbrt/sentrifugo
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('action', BASE_URL . 'geographygroup/edit');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'geographygroup');
     $id = new Zend_Form_Element_Hidden('id');
     $geographygroupname = new Zend_Form_Element_Text('geographygroupname');
     $geographygroupname->setAttrib('maxLength', 50);
     $geographygroupname->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z\\s]+$/i', 'messages' => array('regexNotMatch' => 'Please enter valid geography group.')))));
     $geographygroupname->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_geographygroup', 'field' => 'geographygroupname', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive=1')));
     $geographygroupname->getValidator('Db_NoRecordExists')->setMessage('Geography group name already exists.');
     $geographyregion = new Zend_Form_Element_Text('geographyregion');
     $geographyregion->setAttrib('maxLength', 20);
     $geographyregion->addValidator("regex", true, array('pattern' => '/^[a-zA-Z][a-zA-Z0-9\\s]*$/', 'messages' => array('regexNotMatch' => 'Please enter valid geography region.')));
     $geographycityname = new Zend_Form_Element_Text('geographycityname');
     $geographycityname->setAttrib('maxLength', 20);
     $geographycityname->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z\\s]+$/i', 'messages' => array('regexNotMatch' => 'Please enter valid geography city.')))));
     $defaultGeographyGroup = new Zend_Form_Element_Text('defaultGeographyGroup');
     $defaultGeographyGroup->setAttrib('maxLength', 20);
     $defaultGeographyGroup->addValidator("regex", true, array('pattern' => '/^[a-zA-Z][a-zA-Z0-9\\s]*$/', 'messages' => array('regexNotMatch' => 'Please enter valid default geography group.')));
     $geographycode = new Zend_Form_Element_Text('geographycode');
     $geographycode->setAttrib('maxLength', 20);
     $geographycode->setRequired(true);
     $geographycode->addValidator('NotEmpty', false, array('messages' => 'Please enter geography code.'));
     $geographycode->addValidator("regex", true, array('pattern' => '/^[a-zA-Z][a-zA-Z0-9\\s]*$/', 'messages' => array('regexNotMatch' => 'Please enter valid geography code.')));
     $geographycode->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_geographygroup', 'field' => 'geographycode', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive=1')));
     $geographycode->getValidator('Db_NoRecordExists')->setMessage('Geography code already exists.');
     $currency = new Zend_Form_Element_Select('currency');
     $currency->setAttrib('class', 'selectoption');
     $currency->setRegisterInArrayValidator(false);
     $currency->addMultiOption('', 'Select Currency');
     $currencymodel = new Default_Model_Currency();
     $currencymodeldata = $currencymodel->getCurrencyList();
     foreach ($currencymodeldata as $currencyres) {
         $currency->addMultiOption($currencyres['id'], utf8_encode($currencyres['currency']));
     }
     $currency->setRequired(true);
     $currency->addValidator('NotEmpty', false, array('messages' => 'Please select currency.'));
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Save');
     $this->addElements(array($id, $geographygroupname, $geographyregion, $geographycityname, $defaultGeographyGroup, $geographycode, $currency, $submit));
     $this->setElementDecorators(array('ViewHelper'));
 }
コード例 #27
0
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'dependencydetails');
     $id = new Zend_Form_Element_Hidden('id');
     $user_id = new Zend_Form_Element_Hidden('user_id');
     //Dependent Name ...
     $dependent_name = new Zend_Form_Element_Text('dependent_name');
     $dependent_name->addFilter(new Zend_Filter_StringTrim());
     $dependent_name->setRequired(true);
     $dependent_name->setAttrib("maxlength", 50);
     $dependent_name->addValidator('NotEmpty', false, array('messages' => 'Please enter dependent name.'));
     $dependent_name->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z\\s]+$/i', 'messages' => array('regexNotMatch' => 'Please enter only alphabets.')))));
     //Disablity Type
     $dependent_relation = new Zend_Form_Element_Select('dependent_relation');
     $dependent_relation->setRequired(true)->addErrorMessage('Please select dependent relation.');
     $dependent_relation->addValidator('NotEmpty', false, array('messages' => 'Please select dependent relation.'));
     //dependent_custody....
     $dependent_custody = new Zend_Form_Element_Select('dependent_custody');
     $dependent_custody->addValidator('NotEmpty', false, array('messages' => 'Please select dependent custody code.'));
     $dependent_custody->setRequired(true)->addErrorMessage('Please select dependent custody code.');
     $dependent_custody->addMultiOptions(array('' => 'Select Dependent Custody Code', 'both parents' => 'Both Parents', 'former spouse' => 'Former Spouse', 'subscriber only' => 'Subscriber Only', 'other Or unknown' => 'Other Or Unknown'));
     //Dependent DOB...
     $dependent_dob = new ZendX_JQuery_Form_Element_DatePicker('dependent_dob');
     $dependent_dob->setOptions(array('class' => 'brdr_none'));
     $dependent_dob->setAttrib('onchange', 'calcDays("dependent_dob","",this,1)');
     $dependent_dob->setRequired(true);
     $dependent_dob->setAttrib('readonly', 'true');
     $dependent_dob->setAttrib('onfocus', 'this.blur()');
     $dependent_dob->addValidator('NotEmpty', false, array('messages' => 'Please select date.'));
     //dependent_age ...
     $dependent_age = new Zend_Form_Element_Text('dependent_age');
     $dependent_age->addFilter(new Zend_Filter_StringTrim());
     $dependent_age->setAttrib("maxlength", 3);
     $dependent_age->setAttrib('readonly', 'true');
     $dependent_age->setAttrib('onfocus', 'this.blur()');
     //Form Submit....
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Save');
     $this->addElements(array($id, $user_id, $dependent_name, $dependent_relation, $dependent_custody, $dependent_dob, $dependent_age, $submit));
     $this->setElementDecorators(array('ViewHelper'));
     $this->setElementDecorators(array('UiWidgetElement'), array('dependent_dob'));
 }
コード例 #28
0
ファイル: Login.php プロジェクト: rodrigorm/godeploy
 public function __construct($options = null)
 {
     parent::__construct($options);
     $this->setName('login_form')->setAction('/auth/login')->setMethod('post');
     $username = new Zend_Form_Element_Text('username');
     $username->setLabel(_r('Username'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim');
     $not_empty = new Zend_Validate_NotEmpty();
     $not_empty->setMessage(_r('Please enter your User Name'));
     $username->addValidators(array($not_empty));
     $password = new Zend_Form_Element_Password('password');
     $password->setLabel(_r('Password'))->setRequired(true)->addFilter('StripTags');
     $not_empty = new Zend_Validate_NotEmpty();
     $not_empty->setMessage(_r('Please enter your Password'));
     $password->addValidators(array($not_empty));
     $submit = new Zend_Form_Element_Image('btn_submit');
     $submit->setImage('/images/buttons/small/login.png');
     $this->addElements(array($username, $password, $submit));
 }
コード例 #29
0
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('action', BASE_URL . 'employeeleavetypes/edit');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'employeeleavetypes');
     $id = new Zend_Form_Element_Hidden('id');
     $leavetype = new Zend_Form_Element_Text('leavetype');
     $leavetype->setAttrib('maxLength', 50);
     $leavetype->addFilter(new Zend_Filter_StringTrim());
     $leavetype->setRequired(true);
     $leavetype->addValidator('NotEmpty', false, array('messages' => 'Please enter leave type.'));
     $leavetype->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^(?=.*[a-zA-Z])([^ ][a-zA-Z0-9\\-\\s]*)$/', 'messages' => array('regexNotMatch' => 'Please enter valid leave type.')))));
     $leavetype->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_employeeleavetypes', 'field' => 'leavetype', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive=1')));
     $leavetype->getValidator('Db_NoRecordExists')->setMessage('Leave type already exists.');
     $numberofdays = new Zend_Form_Element_Text('numberofdays');
     $numberofdays->setAttrib('maxLength', 2);
     $numberofdays->addFilter(new Zend_Filter_StringTrim());
     $numberofdays->setRequired(true);
     $numberofdays->addValidator('NotEmpty', false, array('messages' => 'Please enter number of days.'));
     $numberofdays->addValidator("regex", true, array('pattern' => '/^[0-9]+$/', 'messages' => array('regexNotMatch' => 'Please enter only numbers.')));
     $leavecode = new Zend_Form_Element_Text('leavecode');
     $leavecode->setAttrib('maxLength', 50);
     $leavecode->addFilter(new Zend_Filter_StringTrim());
     $leavecode->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 leave short code.')))));
     $leavecode->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_employeeleavetypes', 'field' => 'leavecode', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive=1')));
     $leavecode->getValidator('Db_NoRecordExists')->setMessage('Leave Code already exists.');
     $leavepreallocated = new Zend_Form_Element_Select('leavepreallocated');
     $leavepreallocated->setRegisterInArrayValidator(false);
     $leavepreallocated->setMultiOptions(array('1' => 'Yes', '2' => 'No'));
     $leavepredeductable = new Zend_Form_Element_Select('leavepredeductable');
     $leavepredeductable->setRegisterInArrayValidator(false);
     $leavepredeductable->setMultiOptions(array('1' => 'Yes', '2' => 'No'));
     $description = new Zend_Form_Element_Textarea('description');
     $description->setAttrib('rows', 10);
     $description->setAttrib('cols', 50);
     $description->setAttrib('maxlength', '200');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Save');
     $this->addElements(array($id, $leavetype, $numberofdays, $leavecode, $leavepreallocated, $leavepredeductable, $description, $submit));
     $this->setElementDecorators(array('ViewHelper'));
 }
コード例 #30
0
 public function init()
 {
     // Set the method for the display form to POST
     $this->setMethod('post');
     $this->setAttribs(array('class' => 'form-horizontal'));
     $decoratorField = new My_Decorator_FieldLogin();
     $elements = array();
     // Add email field
     $input = new Zend_Form_Element_Text('email', array('required' => true, 'label' => 'Email Address:', 'id' => 'email', 'placeholder' => 'Your email..', 'class' => 'form-control', 'type' => 'email'));
     $validator = new Zend_Validate_EmailAddress();
     $input->addValidators(array($validator, new Zend_Validate_NotEmpty()));
     $input->addDecorator($decoratorField);
     $elements[] = $input;
     //Add Submit button
     $input = new Zend_Form_Element_Submit('submit', array('Label' => '', 'class' => 'btn btn-default', 'value' => 'Reset'));
     $input->addDecorator($decoratorField);
     $elements[] = $input;
     $this->addElements($elements);
     $this->addDisplayGroup(array('email', 'submit'), 'displgrp', array('decorators' => array('FormElements', 'Fieldset')));
 }