public function init()
 {
     /* Form Elements & Other Definitions Here ... */
     $province = new Zend_Dojo_Form_Element_ComboBox('province');
     $province->setLabel('province')->setRequired(true);
     $agent = new Zend_Dojo_Form_Element_ComboBox('agent');
     $agent->setLabel('agent')->setRequired(true);
     $sender = new Zend_Dojo_Form_Element_ValidationTextBox('sender');
     $sender->setLabel('sender')->setRequired(true);
     $reciever = new Zend_Dojo_Form_Element_ValidationTextBox('reciever');
     $reciever->setLabel('reciever')->setRequired(true);
     $reciever_tel = new Zend_Dojo_Form_Element_ValidationTextBox('reciever_tel');
     $reciever_tel->setLabel('reciever_tel')->setRequired(true);
     $send_date = new Zend_Dojo_Form_Element_DateTextBox('send_date');
     $send_date->setLabel('send_date')->setRequired(true);
     $exp_date = new Zend_Dojo_Form_Element_DateTextBox('expire_date');
     $exp_date->setLabel('expire date')->setRequired(true);
     $type_money = new Zend_Dojo_Form_Element_ComboBox('type_money');
     $type_money->setLabel('type_money')->setRequired(true);
     $amount = new Zend_Dojo_Form_Element_CurrencyTextBox('asd');
     $submit_login = new Zend_Dojo_Form_Element_SubmitButton('submit_login');
     $submit_login->setLabel('ចាប់​ផ្តើម');
     $clear_login = new Zend_Dojo_Form_Element_Button('clear_login');
     $clear_login->setLabel("សារ​ដើម");
     $this->addElements(array($province, $agent, $sender, $reciever, $reciever_tel, $send_date, $exp_date, $type_money, $submit_login, $clear_login));
 }
Beispiel #2
0
 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_TextBox('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_TextBox('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');
     $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_TextBox('maximunloanamount');
     $maximunloanamount->setAttrib('class', 'txt_put');
     $maximunloanamount->setRequired(true);
     $validator = new Zend_Validate_Digits();
     $maximunloanamount->addValidator($validator, true);
     $minimumfrequency = new Zend_Dojo_Form_Element_TextBox('minimumfrequency');
     $minimumfrequency->setAttrib('class', 'txt_put');
     $minimumfrequency->setRequired(true)->addValidators(array(array('NotEmpty')));
     $maximumfrequency = new Zend_Dojo_Form_Element_TextBox('maximumfrequency');
     $maximumfrequency->setAttrib('class', 'txt_put');
     $maximumfrequency->setRequired(true)->addValidators(array(array('NotEmpty')));
     $graceperiodnumber = new Zend_Dojo_Form_Element_TextBox('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));
 }
Beispiel #3
0
 public function loadORM(ORM $obj, $namespace = null)
 {
     $this->setElementsBelongTo(lcfirst($namespace));
     $fields = $obj->ormFields();
     foreach ($fields as $field) {
         if (!is_object($obj->{$field})) {
             if (preg_match('/^date.*/', $field)) {
                 $element = new Zend_Dojo_Form_Element_DateTextBox($field);
                 $element->setLabel($this->_prettyName($field));
             } elseif (preg_match('/.*_id$/', $field)) {
                 $element = $this->createElement('hidden', $field, array('label' => $this->_prettyName($field)));
             } else {
                 $element = $this->createElement('text', $field, array('label' => $this->_prettyName($field)));
             }
             $element->setValue($obj->{$field});
             $this->addElement($element);
         } elseif ($obj->{$field} instanceof ORM) {
             $sf = new WebVista_Form();
             $this->addSubForm($sf, "form" . ucwords($field));
             $sf->loadORM($obj->{$field}, $namespace . '[' . lcfirst($field) . ']');
         }
     }
 }