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
精彩评论