Datepicker No Longer Works After Using Chtml:ajaxbutton

Hi all,

I have a form with 2 date zones where I am using CJuiDatePicker. I have also on the same form a CHtml:ajaxButton which I use to create customer data if the latter does not exist. This avoids the user to have to leave the form, create the customer data and return to the form. I have noted that when I do not have to create the customer, the datepickers for the 2 dates work fine. They stop working when I use the Chtml:ajaxButton to create customers. How do I reactivate the datepickers? I tried to use afterajaxupdate but it did not work. Here is my code:

Form view


	<td colspan="2">

<div id="cl"> 		

		<?php echo $form->dropDownList($model,'client',

 		CHtml::listData(Client::model()->findAll(array('order'=>'name ASC')), 'id_client', 'FullName'),array('prompt'=>'Select')); ?>

    	<?php echo CHtml::ajaxButton(Yii::t('cl','New Client'),$this->createUrl('client/addnew'),

    	array('onclick'=>'$("#clDialog").dialog("open"); return false;','update'=>'#clDialog',

    	'afterAjaxUpdate'=>"function(){jQuery('#arr,#dep').datepicker({'dateFormat': 'dd-mm-yy'})}",), // does not work


    		<div id="clDialog"></div>


	<td colspan="2"><?php echo $form->dropDownList($model,'roomtype',

 		CHtml::listData(Roomtype::model()->findAll(), 'id', 'DescripId'),array('class'=>'room','id'=>'rmtype')); ?>				

		<?php echo $form->error($model,'roomtype'); ?></td>




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

		'name' => CHtml::activeName($model, 'arrival'),



		'value' => $model->arrival,









Action addnew in client controller:

	public function actionAddnew() {

	                $model=new Client;

	        // Ajax Validation enabled


	        // Flag to know if we will render the form or try to add 

	        // new client.



	        {       $flag=false;



	           if($model->save()) {

	              //Return an <option> and select it

	                            echo CHtml::tag('option',array (






	                if($flag) {

	                    Yii::app()->clientScript->scriptMap['jquery.js'] = false;




Thanks beforehand


No one to help? Or is the question too silly?