public function __construct($options = null) { Zend_Dojo::enableForm($this); parent::__construct($options); $product_id = new Zend_Dojo_Form_Element_ComboBox('product_id'); $product_id->addMultiOption('', 'Select...'); $product_id->setAttrib('class', 'txt_put'); $product_id->setRequired(true)->addValidators(array(array('NotEmpty'))); $offerproductname = new Zend_Dojo_Form_Element_ValidationTextBox('offerproductname'); $offerproductname->addValidator(new Zend_Validate_Db_NoRecordExists('ourbank_productsofferdetails', 'offerproductname')); $offerproductname->setAttrib('class', 'txt_put'); $offerproductname->setRequired(true)->addValidators(array(array('NotEmpty'))); $offerproductshortname = new Zend_Dojo_Form_Element_ValidationTextBox('offerproductshortname'); $offerproductshortname->addValidator(new Zend_Validate_Db_NoRecordExists('ourbank_productsofferdetails', 'offerproductshortname')); $offerproductshortname->setAttrib('class', 'txt_put'); $offerproductshortname->setRequired(true)->addValidators(array(array('NotEmpty'))); $offerproduct_description = new Zend_Dojo_Form_Element_SimpleTextarea('offerproduct_description', array('rows' => 3, 'cols' => 20)); $offerproduct_description->setAttrib('class', ''); $offerproduct_description->setRequired(true)->addValidators(array(array('NotEmpty'))); // $begindate = new Zend_Dojo_Form_Element_DateTextBox('begindate'); // $begindate->setLabel('Birthday'); $begindate = new ZendX_JQuery_Form_Element_DatePicker('begindate', array('label' => 'Date:')); $begindate->setJQueryParam('dateFormat', 'yy-mm-dd'); $begindate->setAttrib('class', 'txt_put'); $begindate->setRequired(true)->addValidators(array(array('Date', true, array('messages' => array('dateNotYYYY-MM-DD' => 'Please enter in this format(YYYY-MM-DD)', 'dateInvalid' => "'%value%' is not a valid date Please enter in this format(YYYY-MM-DD)"))), array('Between', false, array($beginDate, $matureDate, 'messages' => array('notBetween' => 'date should be between ' . $beginDate . ' to (Closed date) ' . $matureDate))))); $minmumloanamount = new Zend_Dojo_Form_Element_NumberSpinner('minmumloanamount', array('value' => '7', 'label' => 'NumberSpinner', 'smallDelta' => 5, 'largeDelta' => 25, 'defaultTimeout' => 500, 'timeoutChangeRate' => 100, 'min' => 9, 'max' => 1550, 'places' => 0, 'maxlength' => 20)); $minmumloanamount->setAttrib('class', 'txt_put'); $minmumloanamount->setRequired(true)->addValidators(array(array('NotEmpty'))); $closedate = new Zend_Dojo_Form_Element_TextBox('closedate'); $closedate->setAttrib('class', 'txt_put'); $closedate->setRequired(true)->addValidator(new Zend_Validate_Date('YYYY-MM-DD'), true)->addValidator(new Zend_Validate_GreaterThan($begindate)); $applicableto = new Zend_Dojo_Form_Element_ComboBox('applicableto'); $applicableto->addMultiOption('', 'Select...'); $applicableto->setAttrib('class', 'txt_put'); $applicableto->setRequired(true)->addValidators(array(array('NotEmpty'))); $maximunloanamount = new Zend_Dojo_Form_Element_NumberTextBox('maximunloanamount'); $maximunloanamount->setAttrib('class', 'txt_put'); $maximunloanamount->setRequired(true); $validator = new Zend_Validate_Digits(); $maximunloanamount->addValidator($validator, true); $minimumfrequency = new Zend_Dojo_Form_Element_NumberTextBox('minimumfrequency'); $minimumfrequency->setAttrib('class', 'txt_put'); $minimumfrequency->setRequired(true)->addValidators(array(array('NotEmpty'))); $maximumfrequency = new Zend_Dojo_Form_Element_NumberTextBox('maximumfrequency'); $maximumfrequency->setAttrib('class', 'txt_put'); $maximumfrequency->setRequired(true)->addValidators(array(array('NotEmpty'))); $graceperiodnumber = new Zend_Dojo_Form_Element_NumberTextBox('graceperiodnumber'); $graceperiodnumber->setAttrib('class', 'txt_put'); $graceperiodnumber->setRequired(true)->addValidators(array(array('NotEmpty'))); $submit = new Zend_Dojo_Form_Element_SubmitButton('Submit'); $this->addElements(array($offerproductname, $offerproductshortname, $offerproduct_description, $begindate, $closedate, $applicableto, $minmumloanamount, $maximunloanamount, $minimumfrequency, $maximumfrequency, $graceperiodnumber, $product_id, $submit)); }
public function frmCapital($_data = null) { /* Form Elements & Other Definitions Here ... */ $name_staff = new Zend_Dojo_Form_Element_FilteringSelect('name_staff'); $name_staff->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'onchange' => 'setId();')); $db = new Capital_Model_DbTable_DbCapital(); $opt = $db->getNameCs_users(null, 1); $name_staff->setMultiOptions($opt); // $options= array(1=>"A",2=>"B"); // $name_staff->setMultiOptions($options); $ids = new Zend_Dojo_Form_Element_FilteringSelect('ids'); $ids->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'onchange' => 'setName();')); $db = new Capital_Model_DbTable_DbCapital(); $opt = $db->getIdCs_users(null, 1); $ids->setMultiOptions($opt); $brance = new Zend_Dojo_Form_Element_FilteringSelect('brance'); $brance->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'class' => 'fullside', 'required' => 'true')); // $db = new Application_Model_DbTable_DbGlobal(); // $rows = $db->getAllBranchName(); // $options=''; // if(!empty($rows))foreach($rows AS $row){ // $options[$row['br_id']]=$row['branch_namekh']; // } // $brance->setMultiOptions($options); $date = new Zend_Dojo_Form_Element_DateTextBox('date'); $date->setAttribs(array('dojoType' => 'dijit.form.DateTextBox')); $date->setValue(date('Y-m-d')); $date->setValue(date('Y-m-d')); $_stutas = new Zend_Dojo_Form_Element_FilteringSelect('status'); $_stutas->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect')); $options = array(1 => "ប្រើប្រាស់", 0 => "មិនប្រើប្រាស់"); $_stutas->setMultiOptions($options); $note = new Zend_Dojo_Form_Element_TextBox('note'); $note->setAttribs(array('dojoType' => 'dijit.form.TextBox', 'required' => true)); $usa = new Zend_Dojo_Form_Element_ValidationTextBox('usa'); $usa->setAttribs(array('dojoType' => 'dijit.form.ValidationTextBox', 'required' => true)); $usa->setValue("0"); $bath = new Zend_Dojo_Form_Element_ValidationTextBox('bath'); $bath->setAttribs(array('dojoType' => 'dijit.form.ValidationTextBox', 'required' => true)); $bath->setValue("0"); $reil = new Zend_Dojo_Form_Element_ValidationTextBox('reil'); $reil->setAttribs(array('dojoType' => 'dijit.form.ValidationTextBox', 'required' => true)); $reil->setValue('0'); $id = new Zend_Form_Element_Hidden('id'); if ($_data != null) { $usa->setAttrib('readonly', 1); $reil->setAttrib('readonly', 1); $bath->setAttrib('readonly', 1); if ($_data['currency_id'] == 1) { $usa->setAttrib('readonly', 0); $usa->setValue($_data['amount']); } elseif ($_data['currency_id'] == 2) { $bath->setAttrib('readonly', 0); $bath->setValue($_data['amount']); } elseif ($_data['currency_id'] == 3) { $reil->setAttrib('readonly', 0); $reil->setValue($_data['amount']); } $name_staff->setValue($_data['userid']); $ids->setValue($_data['userid']); $date->setValue($_data['date']); $note->setValue($_data['note']); $_stutas->setValue($_data['status']); $id->setValue($_data['id']); } $this->addElements(array($name_staff, $ids, $date, $_stutas, $note, $bath, $usa, $reil, $id)); return $this; }