Cjuidialog Popup From Cjuigrid

Hi,

I have been following a couple of topics here implementing an update of model from cgridview. I tried a hash of the codes posted but I seem to be missing something.

Objective: Update Date of model from CJuiGrid using a CJuiDialog.

CGridView Code


){

		$this->widget('zii.widgets.grid.CGridView', array(

		'dataProvider'=>$dataProviderReg,

		'columns'=> array(


                          array(							

                            'name'=>'Program Period',

                            'type'=>'raw',

                             'value'=>'$data->startdate."<br/>".$data->enddate."<br/>".

				CHtml::ajaxButton("Extend",

					array("dateUpdate","reg_number"=>$data->reg_number),

				        array(

					"type"=>"POST",

					"url"=>"js:$(this).attr(\"href\")",

                                        "success"=>"alert(\"Date Extended!\")",),

																	array)("onclick"=>"$(\"#extendDialog\").dialog(\"open\"); return false;"))'

															






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

    			'id'=>'extendDialog',

    			'options'=>array(

       		'title'=>'Extend Date',

       		'autoOpen'=>false,

        		'modal'=>true,

        		'closeOnEscape'=>true,

        		'width'=>'350',

        		'height'=>'200',

        		'show'=>array('effect'=>'fold','duration'=>100),

    								),

							));


    			 ?>

    	<iframe id="update-date" width="100%" height="100%" scrolling="no"></iframe>


  <?php 


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




Date Form




<div class="form">


<?php $form=$this->beginWidget('CActiveForm', array(

	'id'=>'reg-form',

	// Please note: When you enable ajax validation, make sure the corresponding

	// controller action is handling ajax validation correctly.

	// There is a call to performAjaxValidation() commented in generated controller code.

	// See class documentation of CActiveForm for details on this.

	'enableAjaxValidation'=>false,

)); ?>


	<p class="note">Fields with <span class="required">*</span> are required.</p>


	<?php echo $form->errorSummary($model); ?>


	<div class="row">

		<?php echo $form->labelEx($model,'reg_enddate'); ?>

		<?php $this->widget('zii.widgets.jui.CJuiDatePicker',array(

		    

		    'model'=>$model,

		    'name'=>'reg_enddate',

		    'attribute'=>'reg_enddate',

		    'options'=>array(

		        'showAnim'=>'fold',

		        'dateFormat'=>'dd-mm-yy',

		   		 ),

		    'htmlOptions'=>array(

		        'style'=>'height:20px;',

		        'value'=>'Please insert date',

		    	),

			)); 

			?>

		<?php echo $form->error($model,'reg_enddate'); ?>

	</div>


	<div class="row buttons">

		<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?>

	</div>


<?php $this->endWidget(); ?>


</div><!-- form -->




Controller Code




public function actionDateUpdate()

	{

		$model = $this->loadModel($_GET['reg_number']);

		if(isset($_POST['Reg']))

		{

			$model->attributes = $_POST['Reg'];

			

			if ($model->save())

			{

				$this->redirect('activeReg');

			}

		}

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




The current code brings up a blank CJuiDialog without any fields for entry. I tried another iteration with CButtonColumn. This time it did bring a CJuiDialog successfully with a ‘dateUpdate’ form but the CJuiDatePicker seems to be inactive and it resulted in a manual date entry.

I’m not quite sure what is currently wrong with the current code. It might be an ajax issue but any form of help will be most appreciated.

Thanks!!