I am working on a jquerymobile project and am trying to use enableClientValidation=true and/or enableAjaxValidation=true on my CActiveForm to check user data against some rules in my model.
If I load the view url manually (index.php?r=log/checkin), validation works as expected. However, if I try to render the view from my controller, the view never loads. I’m simply stuck with the jquerymobile ajax loading icon. As soon as I disable jquerymobile, the render call in the controller works as expected.
Here are some relevant snippets:
View:
<?php
$form = $this->beginWidget('CActiveForm',array(
'action'=>$this->createUrl('//log/recordCheckin'),
'id'=>'checkin',
'enableAjaxValidation'=>false,
'enableClientValidation' => true,
'clientOptions' => array(
'validateOnChange' => true,
'validateOnSubmit' => true,
)
));
echo CHtml::activeTextField($model,'email',array(
'placeholder'=>$model->getAttributeLabel('email')
));
echo $form->error($model,'email');
$this->endWidget(); ?>
Controller:
public function actionCheckin(){
$model = $this->getModel();
$this->render('checkin',array('model'=>$model));
}
Any ideas of why this is so and how to enable both jquerymobile AND ajax form validation so that I can actually launch my view from the controller? I’d highly appreciate any assistance on this. Thanks!