deepnath
(Deepnathkundu01)
1
Hi all
Please any one tell me.why my ajax validation is not working in my form.
In view
In Controller
In Model
Any help will be highly appreciated
weavora
(Yury Tolochko)
2
Seems like you marked required fields also as ‘safe’ (without validate), so just remove line in model:
array(‘msg_to,msg_subject,msg_message’, ‘safe’),
deepnath
(Deepnathkundu01)
3
I also comment that line But still it is not working?
weavora
(Yury Tolochko)
4
$model = new MessageCFmodel;
echo $_POST['ajax'];
if(isset($_POST['ajax']) && $_POST['ajax']==='msgform')
{
$model->attributes=$_POST['MessageCFmodel'];
//MessageCFmodel::validate();
$model->validate();
Yii::app()->end();
}
Replace with
$model = new MessageCFmodel;
if(isset($_POST['ajax']) && $_POST['ajax']==='msgform')
{
$model->attributes=$_POST['MessageCFmodel'];
echo CActiveForm::validate($model);
Yii::app()->end();
}
Hope it will solve your problem.