EJuiDateTimePicker not working inside a CJuiDialog

This seemed to be asked before but applying such answers did not gave me the solution. I have a create form which records the payments of the clients. It works just fine until I tried to transfer it inside a CJuiDialog in another view.

And this is how i put the datetimepicker in my _form.php:

<div class="row">

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



            'model'=>$model, //Model object

            'attribute'=>'payment_date', //attribute name


            'value'=>date('MM-dd-yy H:i:s'),

            'mode'=>'datetime', //use "time","date" or "datetime" (default)




             ) // jquery plugin options



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


and in my view.php here is how i implemented my CJuiDialog:


        echo CHtml::ajaxLink(

        "Make Payments", //link label

        Yii::app()->createUrl( 'tcfunecareModule/payments/create'),

        array( // ajaxOptions

            'type' => 'GET',

            'success' => "function( data )


                    //alert( data );




            'data' => array( 'id' => $model->contract_id, 'bal'=>$model->contract_balance)


        array('class'=>'btn btn-info pull-right')



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

        'id' => "mydialog",

        'options' => array(

        'autoOpen' => false,

        'width' => 'auto',

        'height' => 'auto',



        'modal' => true,

        'open'=> 'js:function(event, ui) { $(".ui-dialog-titlebar").hide(); }',

        'buttons' => array(

                Yii::t('app', 'Close') => 'js:function() {$(this).dialog("close");}',




        <div id="dlg-content" style="dispay:none;"></div>





        'model'=>$model, 'contr'=>$id,

    ),false, true);

does not work though

[color="#006400"]/* Moved from 2.0 forum to 1.1 */[/color]

I would not use ajax to create a form. Rather, I would make it ready from the beginning:

     <div id="dlg-content" style="dispay:none;">

     <!-- a form for creation here -->


Then "Make Payments" link will just open the dialog, without doing ajax call.

It may look somewhat stupid, but it’s simpler and safer.