Validation form that renders with renderPartial in yii

I have more than one form on one page, and I process one form with renderPartial, now if I want to test it with ajax check, it does not 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( 'validateOnSubmit' => true, 'validateOnChange'=>false, 'afterValidate'=>'js:postBillShipp' ), )); ?> 

and in the basket / index I have

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

Thank you in advance

+4
source share
1 answer

You should use the 4th parameter for partial display:

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

The fourth parameter is processOutput and you must set it to true API

0
source

All Articles