Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/277.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php EJuiDateTimePicker/CJuiDateTimePicker在CJuiDialog内不工作_Php_Jquery_Ajax_Yii_Cjuidialog - Fatal编程技术网

Php EJuiDateTimePicker/CJuiDateTimePicker在CJuiDialog内不工作

Php EJuiDateTimePicker/CJuiDateTimePicker在CJuiDialog内不工作,php,jquery,ajax,yii,cjuidialog,Php,Jquery,Ajax,Yii,Cjuidialog,以前似乎有人问过这个问题,但应用这些答案并没有给我答案。我有一张记录客户付款的表格。在我尝试在另一个视图的CJuiDialog中传输它之前,它工作得很好。 在my create.php中: <?php /* @var $this PaymentsController */ /* @var $model Payments */ $this->breadcrumbs=array( 'Payments'=>array('index'),

以前似乎有人问过这个问题,但应用这些答案并没有给我答案。我有一张记录客户付款的表格。在我尝试在另一个视图的CJuiDialog中传输它之前,它工作得很好。 在my create.php中:

<?php
    /* @var $this PaymentsController */
    /* @var $model Payments */

    $this->breadcrumbs=array(
        'Payments'=>array('index'),
        'Create',
    );

    $this->menu=array(
        array('label'=>'List Payments', 'url'=>array('index')),
        array('label'=>'Manage Payments', 'url'=>array('admin')),
    );

 ?>

<h4 class="text-success">Payments <span class="glyphicon glyphicon-tag"></span></h4>
<hr>
<?php $this->renderPartial('_form', array('model'=>$model)); ?>
下面是我在my view.php中实现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');
     ?>

嘿,万一有人遇到同样的问题。我这里有解决办法。在控制器中:

public function actionCreate($id, $bal)
{
    $model=new Payments;
    $model->contract_id = $id;
    // Uncomment the following line if AJAX validation is needed
     $this->performAjaxValidation($model);

    if(isset($_POST['Payments']))
    {

        $_POST['Payments']['remaining_balance'] = $bal - $_POST['Payments']['down_payment'];
        $_POST['Payments']['paid_thru'] = $_POST['Payments']['account_id'];
        $balance = $_POST['Payments']['remaining_balance'];
        $model->attributes=$_POST['Payments'];
        if($model->save())
            {
                $model->updateBalance($id, $balance);
                $this->redirect(array('servicecontract/view','id'=>$id));
            }
    }

    $this->renderPartial('create',array(
        'model'=>$model, 'contr'=>$id,
    ),false, true);
}
if (Yii::app()->request->isAjaxRequest) {
        Yii::app()->clientScript->scriptMap['jquery.js'] = false;
        yii::app()->clientScript->scriptMap['jquery-ui.min.js'] = false;
        $this->renderPartial('create',array(
        'model'=>$model,'contr_id'=>$id,
    ),false,true);}

只要将这两个设置为false,你就可以开始了。

嘿,以防有人碰巧遇到同样的问题。我这里有解决办法。在控制器中:

public function actionCreate($id, $bal)
{
    $model=new Payments;
    $model->contract_id = $id;
    // Uncomment the following line if AJAX validation is needed
     $this->performAjaxValidation($model);

    if(isset($_POST['Payments']))
    {

        $_POST['Payments']['remaining_balance'] = $bal - $_POST['Payments']['down_payment'];
        $_POST['Payments']['paid_thru'] = $_POST['Payments']['account_id'];
        $balance = $_POST['Payments']['remaining_balance'];
        $model->attributes=$_POST['Payments'];
        if($model->save())
            {
                $model->updateBalance($id, $balance);
                $this->redirect(array('servicecontract/view','id'=>$id));
            }
    }

    $this->renderPartial('create',array(
        'model'=>$model, 'contr'=>$id,
    ),false, true);
}
if (Yii::app()->request->isAjaxRequest) {
        Yii::app()->clientScript->scriptMap['jquery.js'] = false;
        yii::app()->clientScript->scriptMap['jquery-ui.min.js'] = false;
        $this->renderPartial('create',array(
        'model'=>$model,'contr_id'=>$id,
    ),false,true);}
只要把这两个设为假,你就可以走了