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'); ?>

    <?php 


        $this->widget('EJuiDateTimePicker',array(

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

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

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

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

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

            'language'=>'en-GB',

            'options'=>array(


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

             ) // jquery plugin options

            ));

    ?>      

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

</div>



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




<?php

        echo CHtml::ajaxLink(

        "Make Payments", //link label

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

        array( // ajaxOptions

            'type' => 'GET',

            'success' => "function( data )

                {

                    //alert( data );

                    $('#mydialog').dialog('open');

                    $('#dlg-content').html(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',

        //'show'=>'fade-in',

        'hide'=>'fade',

        '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>

     <?php 

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

     ?>






 $this->renderPartial('create',array(

        '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 -->

     </div>



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

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