I've an active form in my application. But the client side validation is not working. The code of the form are as shown below:
<?php $form=$this->beginWidget('CActiveForm', array(
'id'=>'application-data-student-form',
'enableAjaxValidation'=>false,
'enableClientValidation'=>true,
'clientOptions'=>array('onSubmit'=>true),
'htmlOptions'=>array(
'enctype'=>'multipart/form-data',
'role'=>'form',
'class'=>'form-horizontal'
),
)); ?>
I've used bootstrap 3 in my project. Any idea or solution will be highly appreciated from anybody . . .
I've finally resolved the problem. I'm posting this so that it may help someone with the same problem.
The problem was caused because jquery.js was not loaded properly in the application. The map file was missing that is required by the jquery.js. So I downloaded the latest jquery 2.1.1.min.js & respective map file from [http://jquery.com/download/] and loaded them in the main layout. Now the validation is finally working.
Hope this workaround will help someone with same problem.
Try add in model action something like this:
if (Yii::app()->request->isAjaxRequest){
echo CActiveForm::validate($model);
Yii::app()->end();
}
or uncoment this line
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
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