4

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

Irfan
  • 41
  • 3
  • So a single page request loads multiple form instances? Do you have any js errors in your javascript console? – Jon L. Oct 06 '11 at 20:50

1 Answers1

0

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

Maxim
  • 158
  • 2
  • 12