Hi Friends,
I’m new here, currently i start using Yii framework to do some of my project, i got some problem when i want to perform ajax / client side validation without any refreshing page (If anyone used MVC 4 from ASP.net, there are immediate client side validation without refreshing page before submitting).
Here is how i do the testing, i’m using Default demo page from yii package (yiiframework/demos/blog/index.php/site/login)
In View:
<?php
$this->pageTitle=Yii::app()->name . ' - Login';
$this->breadcrumbs=array(
'Login',
);
?>
<h1>Login</h1>
<p>Please fill out the following form with your login credentials:</p>
<div class="form">
<?php $form=$this->beginWidget('CActiveForm', array(
'id'=>'login-form',
'enableAjaxValidation'=>true,
'enableClientValidation'=>true,
)); ?>
<p class="note">Fields with <span class="required">*</span> are required.</p>
<div class="row">
<?php echo $form->labelEx($model,'username'); ?>
<?php echo $form->textField($model,'username'); ?>
<?php echo $form->error($model,'username'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'password'); ?>
<?php echo $form->passwordField($model,'password'); ?>
<?php echo $form->error($model,'password'); ?>
<p class="hint">
Hint: You may login with <tt>demo/demo</tt>.
</p>
</div>
<div class="row rememberMe">
<?php echo $form->checkBox($model,'rememberMe'); ?>
<?php echo $form->label($model,'rememberMe'); ?>
<?php echo $form->error($model,'rememberMe'); ?>
</div>
<div class="row submit">
<?php echo CHtml::submitButton('Login'); ?>
</div>
<?php $this->endWidget(); ?>
</div><!-- form -->
so i set both
‘enableAjaxValidation’=>true,
‘enableClientValidation’=>true,
But when i try to click on login button, the validation is work but with refreshing page, I just wonder whether the feature that i looking for is available in Yii Framework or not, or maybe i missed some configuration JS script?
Thanks
Andi