I'm trying to enable ajax validation in a form, I've added the right parameters to the form, but it's not working, here's my code:
<?php $form=$this->beginWidget('CActiveForm', array(
'id'=>'user-form',
'enableAjaxValidation'=>true,
'htmlOptions' => array(
'enctype' => 'multipart/form-data',
'enableClientValidation'=>true
),
)); ?>
Please advice.
In the top of your action, add the following lines:
if(isset($_POST['ajax']) && $_POST['ajax']==='user-form'){
echo CActiveForm::validate($model);
Yii::app()->end();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With