CJuiDialog & Buttons - save and validation

Hello there,

This is my dialog:




<?php   

   $this->beginWidget('zii.widgets.jui.CJuiDialog', array(

     'id'=>'tr-dialog',

      'options'=>array(

         'title'=>'Title',

         'autoOpen'=>false,

         'modal'=>true,

         'width'=>240,

	 'resizable'=>true,

         'height'=>170,

		 

		 'buttons' => array(

			'Save'=> 'js:function(){    

                                        $.fn.yiiGridView.update("tr-grid", {

						data: $(this).serialize()

					});

                                      $(this).dialog("close");

				  return false;

				}',

			'Cancel'=>'js:function(){$(this).dialog("close");}',    


		 )

		 

       )

   ));


 $this->renderPartial('_form', array('model'=>$model));

 

 $this->endWidget('zii.widgets.jui.CJuiDialog'); ?>



As you can see when I click at “Save” grid is updated, but I don’t know to to save data from ‘_form’ and validate it (error summary).

Tnx