开发者

validating form which is rendered using renderPartial in yii

开发者 https://www.devze.com 2023-03-16 22:33 出处:网络
I have more then one forms on one page and I am rendering one form using renderPartial, now if I want to validate it using ajax validation it don\'t work.

I have more then one forms on one page and I am rendering one form using renderPartial, now if I want to validate it using ajax validation it don't work.

view code

<?php $form=$this->beginWidget('CActiveForm', array(
                'id'=>'bill-shipp-form',
                'action'=>CController::createUrl('cart/index'),
                'enableAjaxValidation'=>true,
                'focus'=>array($billingShippingInfo,'first_name_b'),
                //'enableClientValidation'=>true,
                'clientOptions' => array(
                         开发者_StackOverflow中文版   'validateOnSubmit' => true,
                            'validateOnChange'=>false,
                            'afterValidate'=>'js:postBillShipp'
                            ),
        )); ?>

and in cart/index I have

if(isset($_POST['ajax']) && $_POST['ajax']==='bill-shipp-form')
        {
            echo CActiveForm::validate($billingShippingInfo);
            Yii::app()->end();
        }

Thanks in advance


You should use 4th parameter for render partial:

$this->render('view',$data,false,TRUE);

The 4th paramater is processOutput and you should set it to true API

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号