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')); }
public function __construct($options = null) { parent::__construct($options); parent::__construct(); $accountCode = new Zend_Form_Element_Hidden('accountcode'); $memberId = new Zend_Form_Element_Hidden('membercode'); $categoryId = new Zend_Form_Element_Hidden('categoryId'); $newStatus = new Zend_Form_Element_Select('newStatus'); $newStatus->setAttrib('class', 'NormalBtn'); $newStatus->setRegisterInArrayValidator(false); $newStatus->setRequired(true); $newStatus->addMultiOption('', 'Select...'); $description = new Zend_Form_Element_Textarea('description'); $description->setAttrib('rows', '2'); $description->setAttrib('cols', '20'); $description->setRequired(true); $totalamount = new Zend_Form_Element_Text('totalamount'); $totalamount->setAttrib('class', 'textfield'); $totalamount->setAttrib('id', 'totalamount'); $totalamount->setAttrib('readonly', 'true'); $totalamount1 = new Zend_Form_Element_Hidden('totalamount1'); $newStatus1 = new Zend_Form_Element_Hidden('newStatus1'); $description1 = new Zend_Form_Element_Hidden('description1'); $submit = new Zend_Form_Element_Submit('Save'); $submit->setAttrib('id', 'save'); $Confirm = new Zend_Form_Element_Submit('Confirm'); $Confirm->setAttrib('class', 'officesubmit'); $submit = new Zend_Form_Element_Submit('Submit'); $submit->setAttrib('class', 'officesubmit'); $this->addElements(array($submit, $newStatus, $description, $accountCode, $memberId, $categoryId, $totalamount, $Confirm, $totalamount1, $newStatus1, $description1)); }
public function init() { $this->setMethod('post'); $this->setAttrib('action', DOMAIN . 'monthslist/edit'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'monthslist'); $id = new Zend_Form_Element_Hidden('id'); $monthname = new Zend_Form_Element_Select('month_id'); $monthname->setAttrib('class', 'selectoption'); $monthname->setRegisterInArrayValidator(false); $monthname->setRequired(true); $monthname->addValidator('NotEmpty', false, array('messages' => 'Please select month name.')); $monthcode = new Zend_Form_Element_Text('monthcode'); $monthcode->setAttrib('maxLength', 20); $monthcode->addFilter(new Zend_Filter_StringTrim()); $monthcode->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_monthslist', 'field' => 'monthcode', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive=1'))); $monthcode->getValidator('Db_NoRecordExists')->setMessage('Month code 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 = "'monthslist/saveupdate/format/json'"; $dialogMsg = "''"; $toggleDivId = "''"; $jsFunction = "'redirecttocontroller(\\'monthslist\\');'"; $this->addElements(array($id, $monthname, $monthcode, $description, $submit)); $this->setElementDecorators(array('ViewHelper')); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'leavereport'); $id = new Zend_Form_Element_Hidden('id'); $employeename = new Zend_Form_Element_Text('employeename'); $employeename->setLabel('Leave Applied By'); $employeename->setAttrib('onblur', 'clearautocompletename(this)'); $department = new Zend_Form_Element_Select('department'); $department->setLabel('Department'); $department->addMultiOption('', 'Select Department'); $department->setAttrib('class', 'selectoption'); $department->setRegisterInArrayValidator(false); $leavestatus = new Zend_Form_Element_Select('leavestatus'); $leavestatus->setLabel('Leave Status'); $leavestatus->setMultiOptions(array('' => 'Select Leave Status', '1' => 'Pending for approval', '2' => 'Approved', '3' => 'Rejected', '4' => 'Cancel')); $leavestatus->setRegisterInArrayValidator(false); $from_date = new ZendX_JQuery_Form_Element_DatePicker('from_date'); $from_date->setLabel('Applied Date'); $from_date->setAttrib('readonly', 'true'); $from_date->setAttrib('onfocus', 'this.blur()'); $from_date->setOptions(array('class' => 'brdr_none')); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $this->addElements(array($id, $employeename, $department, $leavestatus, $from_date, $submit)); $this->setElementDecorators(array('ViewHelper')); $this->setElementDecorators(array('UiWidgetElement'), array('from_date')); }
public function init() { $this->setMethod('post'); $this->setAttrib('action', DOMAIN . 'workeligibilitydoctypes/edit'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'workeligibilitydoctypes'); $id = new Zend_Form_Element_Hidden('id'); $documenttype = new Zend_Form_Element_Text('documenttype'); $documenttype->setAttrib('maxLength', 50); $documenttype->setRequired(true); $documenttype->addValidator('NotEmpty', false, array('messages' => 'Please enter document type.')); $documenttype->addValidator("regex", true, array('pattern' => '/^(?=.*[a-zA-Z])([^ ][a-zA-Z0-9\\-\\s]*)$/', 'messages' => array('regexNotMatch' => 'Please enter valid document type.'))); $documenttype->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_workeligibilitydoctypes', 'field' => 'documenttype', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive=1'))); $documenttype->getValidator('Db_NoRecordExists')->setMessage('Document type already exists.'); $issuingauthority = new Zend_Form_Element_Select('issuingauthority'); $issuingauthority->setRegisterInArrayValidator(false); $issuingauthority->setMultiOptions(array('' => 'Select issuing authority', '1' => 'Country', '2' => 'State', '3' => 'City')); $issuingauthority->setRequired(true); $issuingauthority->addValidator('NotEmpty', false, array('messages' => 'Please select issuing authority.')); $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, $documenttype, $issuingauthority, $description, $submit)); $this->setElementDecorators(array('ViewHelper')); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'leavemanagementreport'); $id = new Zend_Form_Element_Hidden('id'); $department = new Zend_Form_Element_Select('department_id'); $department->setLabel('Department'); $department->addMultiOption('', 'Select Department'); $department->setAttrib('class', 'selectoption'); $department->setRegisterInArrayValidator(false); $month = new Zend_Form_Element_Select('cal_startmonth'); $month->setLabel('Start Month'); $month->addMultiOption('', 'Select Calendar Start Month'); $month->setAttrib('class', 'selectoption'); $month->setRegisterInArrayValidator(false); $weekend_startday = new Zend_Form_Element_Select('weekend_startday'); $weekend_startday->setLabel('Week-end 1'); $weekend_startday->addMultiOption('', 'Select Weekend Start Day'); $weekend_startday->setAttrib('class', 'selectoption'); $weekend_startday->setRegisterInArrayValidator(false); $weekend_endday = new Zend_Form_Element_Select('weekend_endday'); $weekend_endday->setLabel('Week-end 2'); $weekend_endday->addMultiOption('', 'Select Weekend End Day'); $weekend_endday->setAttrib('class', 'selectoption'); $weekend_endday->setRegisterInArrayValidator(false); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $this->addElements(array($id, $department, $month, $weekend_startday, $weekend_endday, $submit)); $this->setElementDecorators(array('ViewHelper')); }
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')); }
public function init() { $this->setMethod('post'); $this->setAttrib('action', DOMAIN . 'employmentstatus/edit'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'employmentstatus'); $id = new Zend_Form_Element_Hidden('id'); $workcode = new Zend_Form_Element_Text('workcode'); $workcode->setAttrib('maxLength', 20); $workcode->setRequired(true); $workcode->addValidator('NotEmpty', false, array('messages' => 'Please enter work short code.')); $workcode->addValidator("regex", true, array('pattern' => '/^(?=.*[a-zA-Z])([^ ][a-zA-Z0-9 ]*)$/', 'messages' => array('regexNotMatch' => 'Please enter valid work short code.'))); $workcodename = new Zend_Form_Element_Select('workcodename'); $workcodename->setAttrib('class', 'selectoption'); $workcodename->setRegisterInArrayValidator(false); $workcodename->setRequired(true); $workcodename->addValidator('NotEmpty', false, array('messages' => 'Please select work code.')); $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, $workcode, $workcodename, $description, $submit)); $this->setElementDecorators(array('ViewHelper')); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'frm_interview_rpt'); $interview_date = new Zend_Form_Element_Text("interview_date"); $interview_date->setLabel("Interview Date"); $interview_date->setAttrib('readonly', 'readonly'); $req_id = new Zend_Form_Element_Select("req_id"); $req_id->setRegisterInArrayValidator(false); $req_id->setLabel("Requisition Code")->addMultiOptions(array('' => 'Select Requisition Code')); $department_id = new Zend_Form_Element_Select("department_id"); $department_id->setLabel("Department"); $department_id->setRegisterInArrayValidator(false); $department_id->addMultiOptions(array('' => 'Select Department')); $interviewer_id = new Zend_Form_Element_Text("interviewer_id"); $interviewer_id->setLabel("Interviewer"); $interviewer_id->setAttrib('name', ''); $interviewer_id->setAttrib('id', 'idinterviewer_id'); $createdby = new Zend_Form_Element_Text("createdby"); $createdby->setLabel("Interview Planned By"); $createdby->setAttrib('name', ''); $createdby->setAttrib('id', 'idcreatedby'); $submit = new Zend_Form_Element_Button('submit'); $submit->setAttrib('id', 'idsubmitbutton'); $submit->setLabel('Report'); $this->addElements(array($submit, $interview_date, $req_id, $department_id, $interviewer_id, $createdby)); $this->setElementDecorators(array('ViewHelper')); }
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('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')); }
public function init() { // profissional_beleza_id $profissional_beleza_id = new Zend_Form_Element_Radio("profissional_beleza_id"); $profissional_beleza_id->setLabel("Selecione o profissional desejado: "); $profissional_beleza_id->setRegisterInArrayValidator(false); $profissional_beleza_id->setRequired(); $profissional_beleza_id->setDecorators(App_Forms_Decorators::$checkboxElementDecorators); // agenda_data $agenda_data = new Zend_Form_Element_Text("agenda_data"); $agenda_data->setLabel("Selecione a data: "); $agenda_data->setAttribs(array('class' => 'form-control', 'autocomplete' => 'off')); $agenda_data->setRequired(); $agenda_data->setDecorators(App_Forms_Decorators::$simpleElementDecorators); // agenda_hora $agenda_hora = new Zend_Form_Element_Select("agenda_hora"); $agenda_hora->setLabel('Selecione a hora: '); $agenda_hora->setAttribs(array('class' => 'form-control')); $agenda_hora->setMultiOptions(array('' => 'Horários')); $agenda_hora->setRequired(); $agenda_hora->setDecorators(App_Forms_Decorators::$simpleElementDecorators); $agenda_hora->setRegisterInArrayValidator(false); // agenda_observacao $agenda_observacao = new Zend_Form_Element_Textarea("agenda_observacao"); $agenda_observacao->setLabel("Observações: "); $agenda_observacao->setAttribs(array('class' => 'form-control', 'rows' => 7, 'placeholder' => 'Informe alguma observação, por exemplo, alguma preferência de produto, etc.')); // salao_id $salao_id = new Zend_Form_Element_Hidden('salao_id'); // especialidade_id $especialidade_id = new Zend_Form_Element_Hidden("especialidade_id"); // usuario_id $usuario_id = new Zend_Form_Element_Hidden("usuario_id"); $this->addElements(array($profissional_beleza_id, $agenda_data, $agenda_hora, $agenda_observacao, $salao_id, $especialidade_id, $usuario_id)); parent::init(); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'emppersonaldetails'); $id = new Zend_Form_Element_Hidden('id'); $userid = new Zend_Form_Element_Hidden('user_id'); $genderid = new Zend_Form_Element_Select('genderid'); $genderid->addMultiOption('', 'Select Gender'); $genderid->setRegisterInArrayValidator(false); $genderid->setRequired(true); $genderid->addValidator('NotEmpty', false, array('messages' => 'Please select gender.')); $maritalstatusid = new Zend_Form_Element_Select('maritalstatusid'); $maritalstatusid->addMultiOption('', 'Select Marital Status'); $maritalstatusid->setRegisterInArrayValidator(false); $maritalstatusid->setRequired(true); $maritalstatusid->addValidator('NotEmpty', false, array('messages' => 'Please select marital status.')); $ethniccodeid = new Zend_Form_Element_Select('ethniccodeid'); $ethniccodeid->addMultiOption('', 'Select Ethnic Code'); $ethniccodeid->setLabel('Ethnic Code'); $ethniccodeid->setRegisterInArrayValidator(false); $racecodeid = new Zend_Form_Element_Select('racecodeid'); $racecodeid->addMultiOption('', 'Select Race Code'); $racecodeid->setLabel('Race Code'); $racecodeid->setRegisterInArrayValidator(false); $languageid = new Zend_Form_Element_Select('languageid'); $languageid->addMultiOption('', 'Select Language'); $languageid->setLabel('Language'); $languageid->setRegisterInArrayValidator(false); $nationalityid = new Zend_Form_Element_Select('nationalityid'); $nationalityid->addMultiOption('', 'Select Nationality'); $nationalityid->setRegisterInArrayValidator(false); $nationalityid->setRequired(true); $nationalityid->addValidator('NotEmpty', false, array('messages' => 'Please select nationality.')); $dob = new ZendX_JQuery_Form_Element_DatePicker('dob'); $dob->setOptions(array('class' => 'brdr_none')); $dob->setRequired(true); $dob->setAttrib('readonly', 'true'); $dob->setAttrib('onfocus', 'this.blur()'); $dob->addValidator('NotEmpty', false, array('messages' => 'Please select date of birth.')); //DOB should not be current date.... $celebrated_dob = new ZendX_JQuery_Form_Element_DatePicker('celebrated_dob'); $celebrated_dob->setOptions(array('class' => 'brdr_none')); $celebrated_dob->setAttrib('readonly', 'true'); $celebrated_dob->setAttrib('onfocus', 'this.blur()'); $bloodgroup = new Zend_Form_Element_Text('bloodgroup'); $bloodgroup->setAttrib('size', 5); $bloodgroup->setAttrib('maxlength', 10); /*$submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save');*/ $submitadd = new Zend_Form_Element_Button('submitbutton'); $submitadd->setAttrib('id', 'submitbuttons'); $submitadd->setAttrib('onclick', 'validatedocumentonsubmit(this)'); $submitadd->setLabel('Save'); $this->addElements(array($id, $userid, $genderid, $maritalstatusid, $nationalityid, $ethniccodeid, $racecodeid, $languageid, $dob, $celebrated_dob, $bloodgroup, $submitadd)); $this->setElementDecorators(array('ViewHelper')); $this->setElementDecorators(array('UiWidgetElement'), array('dob', 'celebrated_dob')); }
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', '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')); }
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')); }
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')); }
/** Main form */ public function createMigrateForm($assetstores) { // Setup the form $form = new Zend_Form(); $form->setAction('migratemidas2'); $form->setName('migrateForm'); $form->setMethod('post'); $form->setAttrib('class', 'migrateForm'); // Input directory $midas2_hostname = new Zend_Form_Element_Text('midas2_hostname', array('label' => $this->t('MIDAS2 Hostname'), 'size' => 60, 'value' => 'localhost')); $midas2_hostname->setRequired(true); $form->addElement($midas2_hostname); $midas2_port = new Zend_Form_Element_Text('midas2_port', array('label' => $this->t('MIDAS2 Port'), 'size' => 4, 'value' => '5432')); $midas2_port->setRequired(true); $midas2_port->setValidators(array(new Zend_Validate_Digits())); $form->addElement($midas2_port); $midas2_user = new Zend_Form_Element_Text('midas2_user', array('label' => $this->t('MIDAS2 User'), 'size' => 60, 'value' => 'midas')); $midas2_user->setRequired(true); $form->addElement($midas2_user); $midas2_password = new Zend_Form_Element_Password('midas2_password', array('label' => $this->t('MIDAS2 Password'), 'size' => 60, 'value' => 'midas')); $midas2_password->setRequired(true); $form->addElement($midas2_password); $midas2_database = new Zend_Form_Element_Text('midas2_database', array('label' => $this->t('MIDAS2 Database'), ' size' => 60, 'value' => 'midas')); $midas2_database->setRequired(true); $form->addElement($midas2_database); $midas2_assetstore = new Zend_Form_Element_Text('midas2_assetstore', array('label' => $this->t('MIDAS2 Assetstore Path'), 'size' => 60, 'value' => 'C:/xampp/midas/assetstore')); $midas2_assetstore->setRequired(true); $form->addElement($midas2_assetstore); // Button to select the directory on the server $midas2_assetstore_button = new Zend_Form_Element_Button('midas2_assetstore_button', $this->t('Choose')); $midas2_assetstore_button->setDecorators(array('ViewHelper', array('HtmlTag', array('tag' => 'div', 'class' => 'browse-button')), array('Label', array('tag' => 'div', 'style' => 'display:none')))); $form->addElement($midas2_assetstore_button); // Assetstore $assetstoredisplay = array(); $assetstoredisplay[0] = $this->t('Choose one...'); // Initialize with the first type (MIDAS) foreach ($assetstores as $assetstore) { if ($assetstore->getType() == 0) { $assetstoredisplay[$assetstore->getAssetstoreId()] = $assetstore->getName(); } } $assetstore = new Zend_Form_Element_Select('assetstore'); $assetstore->setLabel($this->t('MIDAS3 Assetstore')); $assetstore->setMultiOptions($assetstoredisplay); $assetstore->setDescription(' <a class="load-newassetstore" href="#newassetstore-form" rel="#newassetstore-form" title="' . $this->t('Add a new assetstore') . '"> ' . $this->t('Add a new assetstore') . '</a>')->setDecorators(array('ViewHelper', array('Description', array('escape' => false, 'tag' => false)), array('HtmlTag', array('tag' => 'dd')), array('Label', array('tag' => 'dt')), 'Errors')); $assetstore->setRequired(true); $assetstore->setValidators(array(new Zend_Validate_GreaterThan(array('min' => 0)))); $assetstore->setRegisterInArrayValidator(false); // This array is dynamic so we disable the validator $form->addElement($assetstore); // Submit $submit = new Zend_Form_Element_Button('migratesubmit', $this->t('Migrate')); $form->addElement($submit); return $form; }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'managerleaverequest'); $id = new Zend_Form_Element_Hidden('id'); $appliedleavesdaycount = new Zend_Form_Element_Text('appliedleavesdaycount'); $appliedleavesdaycount->setAttrib('readonly', 'true'); $appliedleavesdaycount->setAttrib('onfocus', 'this.blur()'); $employeename = new Zend_Form_Element_Text('employeename'); $employeename->setAttrib('readonly', 'true'); $employeename->setAttrib('onfocus', 'this.blur()'); $managerstatus = new Zend_Form_Element_Select('managerstatus'); $managerstatus->setRegisterInArrayValidator(false); $managerstatus->setMultiOptions(array('1' => 'Approve', '2' => 'Reject')); $comments = new Zend_Form_Element_Textarea('comments'); $comments->setLabel("Comments"); $comments->setAttrib('rows', 10); $comments->setAttrib('cols', 50); $comments->setAttrib('maxlength', '200'); $leavetypeid = new Zend_Form_Element_Select('leavetypeid'); $leavetypeid->setAttrib('class', 'selectoption'); $leavetypeid->setRegisterInArrayValidator(false); $leavetypeid->setAttrib('readonly', 'true'); $leavetypeid->setAttrib('onfocus', 'this.blur()'); $leaveday = new Zend_Form_Element_Select('leaveday'); $leaveday->setRegisterInArrayValidator(false); $leaveday->setMultiOptions(array('1' => 'Full Day', '2' => 'Half Day')); $leaveday->setAttrib('readonly', 'true'); $leaveday->setAttrib('onfocus', 'this.blur()'); $from_date = new Zend_Form_Element_Text('from_date'); $from_date->setAttrib('readonly', 'true'); $from_date->setAttrib('onfocus', 'this.blur()'); $to_date = new Zend_Form_Element_Text('to_date'); $to_date->setAttrib('readonly', 'true'); $to_date->setAttrib('onfocus', 'this.blur()'); $reason = new Zend_Form_Element_Textarea('reason'); $reason->setAttrib('rows', 10); $reason->setAttrib('cols', 50); $reason->setAttrib('maxlength', '400'); $reason->setAttrib('readonly', 'true'); $reason->setAttrib('onfocus', 'this.blur()'); $leavestatus = new Zend_Form_Element_Text('leavestatus'); $leavestatus->setAttrib('readonly', 'true'); $leavestatus->setAttrib('onfocus', 'this.blur()'); $createddate = new Zend_Form_Element_Text('createddate'); $createddate->setAttrib('readonly', 'true'); $createddate->setAttrib('onfocus', 'this.blur()'); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $this->addElements(array($id, $employeename, $managerstatus, $comments, $reason, $leaveday, $from_date, $to_date, $leavetypeid, $appliedleavesdaycount, $leavestatus, $createddate, $submit)); $this->setElementDecorators(array('ViewHelper')); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'currencyconverter'); $id = new Zend_Form_Element_Hidden('id'); $id_val = Zend_Controller_Front::getInstance()->getRequest()->getParam('id'); $basecurrency = new Zend_Form_Element_Select('basecurrency'); $basecurrency->setAttrib('class', 'selectoption'); $basecurrency->addMultiOption('', 'Select base currency'); $basecurrency->setAttrib('onchange', 'displayTargetCurrency(this)'); $basecurrency->setRegisterInArrayValidator(false); $basecurrency->setRequired(true); $basecurrency->addValidator('NotEmpty', false, array('messages' => 'Please select base currency.')); $targetcurrency = new Zend_Form_Element_Select('targetcurrency'); $targetcurrency->setAttrib('class', 'selectoption'); $targetcurrency->addMultiOption('', 'Select target currency'); $targetcurrency->setRegisterInArrayValidator(false); $targetcurrency->setRequired(true); $targetcurrency->addValidator('NotEmpty', false, array('messages' => 'Please select target currency.')); if ($id_val == '') { $targetcurrency->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_currencyconverter', 'field' => 'targetcurrency', 'exclude' => 'basecurrency="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('basecurrency') . '" AND targetcurrency="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('targetcurrency') . '" and isactive=1'))); $targetcurrency->getValidator('Db_NoRecordExists')->setMessage('Currency combination already exists.'); } $exchangerate = new Zend_Form_Element_Text("exchangerate"); $exchangerate->setAttrib('maxLength', 15); $exchangerate->addFilter(new Zend_Filter_StringTrim()); $exchangerate->setRequired(true); $exchangerate->addValidator('NotEmpty', false, array('messages' => 'Please enter exchange rate.')); $exchangerate->addValidator("regex", false, array("/^[0-9]+(\\.[0-9]{1,6})?\$/", "messages" => "Please enter valid exchange rate.")); $start_date = new ZendX_JQuery_Form_Element_DatePicker('start_date'); $start_date->setAttrib('readonly', 'true'); $start_date->setAttrib('onfocus', 'this.blur()'); $start_date->setOptions(array('class' => 'brdr_none')); $start_date->setRequired(true); $start_date->addValidator('NotEmpty', false, array('messages' => 'Please select start date.')); $end_date = new ZendX_JQuery_Form_Element_DatePicker('end_date'); $end_date->setAttrib('readonly', 'true'); $end_date->setAttrib('onfocus', 'this.blur()'); $end_date->setOptions(array('class' => 'brdr_none')); $end_date->setRequired(true); $end_date->addValidator('NotEmpty', false, array('messages' => 'Please select end date.')); $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, $basecurrency, $targetcurrency, $exchangerate, $start_date, $end_date, $description, $submit)); $this->setElementDecorators(array('ViewHelper')); $this->setElementDecorators(array('UiWidgetElement'), array('start_date', 'end_date')); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'feedforwardinit'); $id = new Zend_Form_Element_Hidden('id'); $postid = Zend_Controller_Front::getInstance()->getRequest()->getParam('id'); $appraisal_mode = new Zend_Form_Element_Select('appraisal_mode'); $appraisal_mode->setLabel("Appraisal"); $appraisal_mode->setMultiOptions(array('' => 'Select Appraisal')); $appraisal_mode->setAttrib('class', 'selectoption'); $appraisal_mode->setRequired(true); $appraisal_mode->addValidator('NotEmpty', false, array('messages' => 'Please select appraisal.')); $status = new Zend_Form_Element_Select('status'); $status->setLabel("Status"); $status->setAttrib('class', 'selectoption'); $status->setMultiOptions(array('1' => 'Open')); //,'2' => 'Close' $status->setRegisterInArrayValidator(false); $status->setRequired(true); $status->addValidator('NotEmpty', false, array('messages' => 'Please select status.')); $employee_name_view = new Zend_Form_Element_Radio('employee_name_view'); $employee_name_view->setLabel("Employee Details"); $employee_name_view->addMultiOptions(array('1' => 'Show', '0' => 'Hide')); $employee_name_view->setSeparator(''); $employee_name_view->setValue(0); $employee_name_view->setRegisterInArrayValidator(false); $enable_to = new Zend_Form_Element_MultiCheckbox('enable_to'); $enable_to->setLabel("Enable To"); $enable_to->addMultiOptions(array('0' => 'Appraisal Employees', '1' => 'All Employees')); $enable_to->setSeparator(''); $enable_to->setValue(0); $enable_to->setRequired(true); $enable_to->setRegisterInArrayValidator(false); $enable_to->addValidator('NotEmpty', false, array('messages' => 'Please check enable to.')); $ff_due_date = new Zend_Form_Element_Text('ff_due_date'); $ff_due_date->setLabel("Due Date"); $ff_due_date->setOptions(array('class' => 'brdr_none')); $ff_due_date->setRequired(true); $ff_due_date->addValidator('NotEmpty', false, array('messages' => 'Please select due date.')); $save = new Zend_Form_Element_Submit('submit'); $save->setAttrib('id', 'submitbutton'); $save->setLabel('Save & Initialize'); $save_later = new Zend_Form_Element_Submit('submit'); $save_later->setAttrib('id', 'submitbutton1'); $save_later->setLabel('Save & Initialize Later'); $this->addElements(array($id, $appraisal_mode, $status, $employee_name_view, $ff_due_date, $save, $save_later, $enable_to)); $this->setElementDecorators(array('ViewHelper')); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'frm_multiple_resume'); $this->setAttrib('name', 'frm_multiple_resume'); $this->setAttrib('action', BASE_URL . 'candidatedetails/multipleresume'); $id = new Zend_Form_Element_Hidden('id'); $id_val = Zend_Controller_Front::getInstance()->getRequest()->getParam('id', null); $requisition_id = new Zend_Form_Element_Select("requisition_id"); $requisition_id->setRegisterInArrayValidator(false); $requisition_id->setLabel("Requisition ID"); $requisition_id->setAttrib("class", "formDataElement"); $requisition_id->setAttrib('onchange', 'displayParticularCandidates(this,"cand")'); $requisition_id->setAttrib('title', 'Requisition ID'); if ($id_val == '') { $requisition_id->setRequired(true); $requisition_id->addValidator('NotEmpty', false, array('messages' => 'Please select requisition id.')); } $candidate_firstname = new Zend_Form_Element_Text('candidate_firstname'); $candidate_firstname->setIsArray(TRUE); $candidate_firstname->setAttrib('maxLength', 90); $candidate_firstname->setAttrib('title', 'Candidate First Name'); $candidate_firstname->setAttrib('class', 'candidate_firstname'); $candidate_firstname->addFilter(new Zend_Filter_StringTrim()); $candidate_firstname->setRequired(true); $candidate_firstname->addValidator("regex", true, array('pattern' => '/^[a-zA-Z.\\- ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid candidate first name.'))); $candidate_lastname = new Zend_Form_Element_Text('candidate_lastname'); $candidate_lastname->setIsArray(TRUE); $candidate_lastname->setAttrib('maxLength', 90); $candidate_lastname->setAttrib('title', 'Candidate Last Name'); $candidate_lastname->setAttrib('class', 'candidate_lastname'); $candidate_lastname->addFilter(new Zend_Filter_StringTrim()); $candidate_lastname->setRequired(true); $candidate_lastname->addValidator("regex", true, array('pattern' => '/^[a-zA-Z.\\- ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid candidate last name.'))); $candidate_resumes = new Zend_Form_Element_Hidden('cand_resume'); $candidate_resumes->setIsArray(TRUE); $candidate_resumes->setRequired(true); $candidate_resumes->addValidator('NotEmpty', false, array('messages' => 'Please select file.')); $cand_status = new Zend_Form_Element_Select("cand_status"); $cand_status->setRegisterInArrayValidator(false); $cand_status->setLabel("Status"); $cand_status->setAttrib("class", "formDataElement"); $cand_status->setAttrib('title', 'Candidate status'); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'multiple-submit-button'); $submit->setLabel('Save'); $this->addElements(array($cand_status, $id, $requisition_id, $candidate_firstname, $candidate_lastname, $candidate_resumes, $submit)); $this->setElementDecorators(array('ViewHelper')); }
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')); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'systempreference'); $id = new Zend_Form_Element_Hidden('id'); $dateformatid = new Zend_Form_Element_Select('dateformatid'); $dateformatid->setAttrib('class', 'selectoption'); $dateformatid->setRegisterInArrayValidator(false); $dateformatid->setRequired(true); $dateformatid->addValidator('NotEmpty', false, array('messages' => 'Please select date format.')); $timeformatid = new Zend_Form_Element_Select('timeformatid'); $timeformatid->setAttrib('class', 'selectoption'); $timeformatid->setRegisterInArrayValidator(false); $timeformatid->setRequired(true); $timeformatid->addValidator('NotEmpty', false, array('messages' => 'Please select time format.')); $timezoneid = new Zend_Form_Element_Select('timezoneid'); $timezoneid->setAttrib('class', 'selectoption'); $timezoneid->setRegisterInArrayValidator(false); $timezoneid->setRequired(true); $timezoneid->addValidator('NotEmpty', false, array('messages' => 'Please select time zone preference.')); $timezoneid->addMultiOption('', 'Select Time zone'); $timezoneModal = new Default_Model_Timezone(); $timezoneData = $timezoneModal->fetchAll('isactive=1', 'timezone')->toArray(); foreach ($timezoneData as $data) { $timezoneid->addMultiOption($data['id'], $data['timezone'] . ' [' . $data['timezone_abbr'] . ']'); } $currencyid = new Zend_Form_Element_Select('currencyid'); $currencyid->setAttrib('class', 'selectoption'); $currencyid->setRegisterInArrayValidator(false); $currencyid->setRequired(true); $currencyid->addValidator('NotEmpty', false, array('messages' => 'Please select currency.')); $passwordid = new Zend_Form_Element_Select('passwordid'); $passwordid->setAttrib('class', 'selectoption'); $passwordid->setAttrib('onchange', 'displayPasswordDesc(this)'); $passwordid->setRegisterInArrayValidator(false); $passwordid->setRequired(true); $passwordid->addValidator('NotEmpty', false, array('messages' => 'Please select default password.')); $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($timezoneid, $id, $dateformatid, $timeformatid, $currencyid, $passwordid, $description, $submit)); $this->setElementDecorators(array('ViewHelper')); }
public function __construct($path, $createdid) { //Zend_Dojo::enableForm($this); //parent::__construct($options); //$fieldtype,$fieldname,$table,$columnname,$cssname,$labelname,$required,$validationtype,$min,$max,$rows,$cols,$decorator,$value $formfield = new App_Form_Field(); $office_name = new Zend_Form_Element_Text('name'); $office_name->setRequired(true)->addValidators(array(array('NotEmpty'))); $office_name->setAttrib('class', 'txt_put'); $office_name->addValidator(new Zend_Validate_Db_NoRecordExists('ourbank_office', 'name')); $office_name->addValidator('Alpha', true, array('allowWhiteSpace' => true)); $officeshort_name = new Zend_Form_Element_Text('short_name'); $officeshort_name->setAttrib('class', 'txt_put'); $officeshort_name->setRequired(true)->addValidators(array(array('NotEmpty'), array('stringLength', false, array(3, 3)))); $officeshort_name->addValidator('Alpha', true, array('allowWhiteSpace' => true)); $officedescription = new Zend_Form_Element_Text('officedescription'); $officedescription->setAttrib('class', 'txt_put'); $officetypename = new Zend_Form_Element_Text('officetypename', array("disabled" => "disabled")); $officetypename->setAttrib('class', 'txt_put'); $officetype_id = new Zend_Form_Element_Select('officetype_id'); $officetype_id->setRequired(true); $officetype_id->addMultiOption('', 'select' . '...'); $officetype_id->setAttrib('class', 'selectbutton'); $officetype_id->setRegisterInArrayValidator(false); //get url path from edit action $officetype_id->setAttrib('onchange', 'getInterests(this.value,"' . $path . '"),getaddress(this.value,"' . $path . '")'); $parentoffice_id = new Zend_Form_Element_Select('parentoffice_id'); $parentoffice_id->addMultiOption('', 'Select OfficeType' . '...'); $parentoffice_id->setAttrib('class', 'selectbutton'); $parentoffice_id->setRegisterInArrayValidator(false); $district = $formfield->field('Select', 'district', '', '', '', '', '', '', '', '', '', '', 0, 0); $district->setRegisterInArrayValidator(false); $district->setAttrib('onchange', 'gettaluk(this.value,"' . $path . '")'); $taluque = $formfield->field('Select', 'taluque', '', '', '', '', '', '', '', '', '', '', 0, 0); $taluque->setRegisterInArrayValidator(false); $taluque->setAttrib('onchange', 'gethobli(this.value,"' . $path . '")'); $hobli = $formfield->field('Select', 'hobli', '', '', '', '', '', '', '', '', '', '', 0, 0); $hobli->setRegisterInArrayValidator(false); $hobli->setAttrib('onchange', 'getpanchayath(this.value,"' . $path . '")'); $panchayath = $formfield->field('Select', 'panchayath', '', '', '', '', '', '', '', '', '', '', 0, 0); $panchayath->setRegisterInArrayValidator(false); $created_by = $formfield->field('Hidden', 'createdby', '', '', '', '', '', '', '', '', '', '', 0, $createdid); $created_date = $formfield->field('Hidden', 'createddate', '', '', '', '', '', '', '', '', '', '', 0, date("y/m/d H:i:s")); //add elements to form $this->addElements(array($office_name, $officeshort_name, $officetype_id, $parentoffice_id, $created_by, $created_date, $taluque, $district, $hobli, $panchayath, $officetypename)); }
public function init() { $this->setMethod('post'); //$this->setAttrib('action',BASE_URL.'timemanagement/projects/edit'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'projects'); $id = new Zend_Form_Element_Hidden('id'); $invoice_method = new Zend_Form_Element_Hidden('invoice_method'); $project_name = new Zend_Form_Element_Text('project_name'); $project_name->setAttrib('maxLength', 100); $project_name->setRequired(true); $project_name->addValidator('NotEmpty', false, array('messages' => 'Please enter project name.')); $project_name->addValidator("regex", true, array('pattern' => '/^(?![0-9]*$)[a-zA-Z0-9.,&\\(\\)\\/\\-_\' ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter a valid project name.'))); $project_name->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'tm_projects', 'field' => 'project_name', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and is_active=1'))); $project_name->getValidator('Db_NoRecordExists')->setMessage('Project name already exists.'); $projstatus = new Zend_Form_Element_Select('project_status'); $projstatus->addMultiOption('', 'Select Status'); $projstatus->addMultiOption('initiated', 'Initiated'); $projstatus->addMultiOption('draft', 'Draft'); $projstatus->addMultiOption('in-progress', 'In Progress'); $projstatus->addMultiOption('hold', 'Hold'); $projstatus->addMultiOption('completed', 'Completed'); $projstatus->setRequired(true); $projstatus->setRegisterInArrayValidator(false); $projstatus->addValidator('NotEmpty', false, array('messages' => 'Please select status.')); $base_project = new Zend_Form_Element_Select('base_project'); $base_project->addMultiOption('', 'Select Project'); $base_project->setRegisterInArrayValidator(false); $client = new Zend_Form_Element_Select('client_id'); $client->addMultiOption('', 'Select Client'); $client->setRegisterInArrayValidator(false); $client->setRequired(true); $client->addValidator('NotEmpty', false, array('messages' => 'Please select client.')); $client->addValidator(new Zend_Validate_Db_RecordExists(array('table' => 'tm_clients', 'field' => 'id', 'exclude' => 'is_active = 1'))); $client->getValidator('Db_RecordExists')->setMessage('Selected client is inactivated.'); $description = new Zend_Form_Element_Textarea('description'); $description->setAttrib('rows', 10); $description->setAttrib('cols', 50); $description->setAttrib('maxlength', '500'); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $this->addElements(array($id, $invoice_method, $project_name, $projstatus, $base_project, $description, $client, $submit)); $this->setElementDecorators(array('ViewHelper')); $this->setElementDecorators(array('UiWidgetElement'), array('start_date', 'end_date')); }
public function init() { $this->setMethod('post'); //$this->setAttrib('action',DOMAIN.'language/edit'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'servicedeskrequests'); $id = new Zend_Form_Element_Hidden('id'); $servicedeskdepartment = new Zend_Form_Element_Select('service_desk_id'); $servicedeskdepartment->setLabel("Category"); $servicedeskdepartment->setAttrib('class', 'selectoption'); $servicedeskdepartment->addMultiOption('', 'Select category'); $servicedeskdepartment->setRegisterInArrayValidator(false); $servicedeskdepartment->setRequired(true); $servicedeskdepartment->addValidator('NotEmpty', false, array('messages' => 'Please select category.')); $postid = Zend_Controller_Front::getInstance()->getRequest()->getParam('id'); if ($postid != '') { $servicedeskrequest = new Zend_Form_Element_Text("service_request_name"); $servicedeskrequest->setLabel("Request Type"); $servicedeskrequest->setAttrib('maxLength', 30); $servicedeskrequest->addFilter(new Zend_Filter_StringTrim()); $servicedeskrequest->setRequired(true); $servicedeskrequest->addValidator('NotEmpty', false, array('messages' => 'Please enter request type.')); $servicedeskrequest->addValidator("regex", true, array('pattern' => '/^[a-zA-Z0-9\\- ]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid request type.'))); $servicedeskrequest->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_sd_reqtypes', 'field' => 'service_request_name', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" AND service_desk_id="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('service_desk_id') . '" AND isactive=1'))); $servicedeskrequest->getValidator('Db_NoRecordExists')->setMessage('Request type already exists for the category.'); $description = new Zend_Form_Element_Textarea('description'); $description->setLabel("Description"); $description->setAttrib('rows', 10); $description->setAttrib('cols', 50); $description->setAttrib('maxlength', '200'); $submit = new Zend_Form_Element_Submit('submitbutton'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Update'); } $submitadd = new Zend_Form_Element_Button('submitbutton'); $submitadd->setAttrib('id', 'submitbuttons'); $submitadd->setAttrib('onclick', 'validaterequestsonsubmit(this)'); $submitadd->setLabel('Save'); if ($postid != '') { $this->addElements(array($id, $servicedeskdepartment, $servicedeskrequest, $description, $submit)); } else { $this->addElements(array($id, $servicedeskdepartment, $submitadd)); } $this->setElementDecorators(array('ViewHelper')); }
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')); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'appraisalquestions'); $id = new Zend_Form_Element_Hidden('id'); $category = new Zend_Form_Element_Select('pa_category_id'); $category->setLabel("Parameter"); $category->setAttrib('class', 'selectoption'); $category->addMultiOption('', 'Select parameter'); $category->setRegisterInArrayValidator(false); $category->setRequired(true); $category->addValidator('NotEmpty', false, array('messages' => 'Please select parameter.')); $postid = Zend_Controller_Front::getInstance()->getRequest()->getParam('id'); if ($postid != '') { $question = new Zend_Form_Element_Text("question"); $question->setLabel('Question'); $question->setAttrib('maxLength', 100); $question->addFilter(new Zend_Filter_StringTrim()); $question->setRequired(true); $question->addValidator('NotEmpty', false, array('messages' => 'Please enter question.')); $question->addValidator("regex", true, array('pattern' => '/^[a-zA-Z0-9.\\- ?\',\\/#@$&*()!]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid question.'))); $question->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_pa_questions', 'field' => 'question', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" AND pa_category_id="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('pa_category_id') . '" AND isactive=1'))); $question->getValidator('Db_NoRecordExists')->setMessage('Question already exists for the parameter.'); $description = new Zend_Form_Element_Textarea('description'); $description->setLabel("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'); $submitadd = new Zend_Form_Element_Button('submitbutton'); $submitadd->setAttrib('id', 'submitbuttons'); $submitadd->setAttrib('onclick', 'validatequestiononsubmit(this)'); $submitadd->setLabel('Save'); if ($postid != '') { $this->addElements(array($id, $category, $question, $description, $submit)); } else { $this->addElements(array($id, $category, $submitadd)); } $this->setElementDecorators(array('ViewHelper')); }
public function init() { $this->setMethod('post'); $this->setAttrib('action', DOMAIN . 'countries/edit'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'countries'); $id = new Zend_Form_Element_Hidden('id'); $country = new Zend_Form_Element_Select('country'); $country->setAttrib('class', 'selectoption'); $country->setAttrib('onchange', 'displayCountryCode(this)'); $country->setRegisterInArrayValidator(false); $country->addMultiOption('', 'Select Country'); $countrymodel = new Default_Model_Countries(); $id_val = Zend_Controller_Front::getInstance()->getRequest()->getParam('id', null); $actionName = Zend_Controller_Front::getInstance()->getRequest()->getActionName(); if ($id_val == '' || $actionName == 'view') { $countrymodeldata = $countrymodel->getTotalCountriesList('addcountry'); foreach ($countrymodeldata as $countryres) { $country->addMultiOption($countryres['id'], utf8_encode($countryres['country_name'])); } $country->addMultiOption('other', 'Other'); } $country->setRequired(true); $country->addValidator('NotEmpty', false, array('messages' => 'Please select country.')); $country->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_countries', 'field' => 'country_id_org', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive=1'))); $country->getValidator('Db_NoRecordExists')->setMessage('Country already exists.'); $countrycode = new Zend_Form_Element_Text('countrycode'); $countrycode->setAttrib('maxLength', 20); $countrycode->setAttrib('readonly', true); $countrycode->setAttrib('onfocus', 'this.blur()'); $countrycode->setRequired(true); $countrycode->addValidator('NotEmpty', false, array('messages' => 'Please enter country code.')); $countrycode->addValidator("regex", true, array('pattern' => '/^(?=.*[a-zA-Z])([^ ][a-zA-Z0-9 ]*)$/', 'messages' => array('regexNotMatch' => 'Please enter valid country code.'))); $citizenship = new Zend_Form_Element_Text('citizenship'); $citizenship->setAttrib('maxLength', 20); $citizenship->setRequired(true); $citizenship->addValidator('NotEmpty', false, array('messages' => 'Please enter citizenship.')); $citizenship->addValidator("regex", true, array('pattern' => '/^[a-zA-Z\\s]*$/i', 'messages' => array('regexNotMatch' => 'Please enter valid citizenship.'))); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $this->addElements(array($id, $country, $countrycode, $citizenship, $submit)); $this->setElementDecorators(array('ViewHelper')); }