Pages

Sunday, August 24, 2014

ZendX-Use events and properties of jquery-ui widgets in Zend forms

Recently I added a ZendX Date Picker to one of my Zend Applications now I was able to add properties but I was unable to add events so I had to use another Zend magic function
Zend_Json_Expr

As shown in code below

    /*************Order Date From****************************************/     
         $order_date_from = new ZendX_JQuery_Form_Element_DatePicker('order_date_from',  
               array('jQueryParams' => array('dateFormat' => 'yy-mm-dd',  
                 'onClose'=>new Zend_Json_Expr('function( selectedDate ) {$( "#order_date_to" ).datepicker( "option", "minDate", selectedDate );}')  
                 ))  
           );  
         $order_date_from->setAttribs(array('class'=>"",  
             //'id'=>'datepickerfrom'  
         )  
           );  
         $order_date_from->removeDecorator('DtDdWrapper')  
           ->removeDecorator('HtmlTag')  
           ->removeDecorator('Errors')  
           ->removeDecorator('Label');  
         $this->addElement($order_date_from);  
         /*************Order Date From****************************************/  
         /*************Order Date To****************************************/  
         $order_date_to = new ZendX_JQuery_Form_Element_DatePicker('order_date_to',  
               array('jQueryParams' => array(  
                 'onClose'=>new Zend_Json_Expr('function( selectedDate) {$( "#order_date_from" ).datepicker( "option", "maxDate", selectedDate );}'),  
                 'dateFormat' => 'yy-mm-dd'              
                 ))  
           );  
         $order_date_to->setAttribs(array('class'=>"",  
             //'id'=>'datepickerto'  
         )  
           );  
         $order_date_to->removeDecorator('DtDdWrapper')  
           ->removeDecorator('HtmlTag')  
           ->removeDecorator('Errors')  
           ->removeDecorator('Label');  
         $this->addElement($order_date_to);  
         /*************Order Date To****************************************/  

No comments:

Post a Comment