How to use client side validation in yii 1.1.7(example needed)

can any one give me an example on how to integrate the client side validation in yii…




[color=#222222][font=Arial, sans-serif][size=4]<?php $form = $this->beginWidget('CActiveForm', array(    'id'=>'user-form',    'enableAjaxValidation'=>true,    'enableClientValidation'=>true,    'focus'=>array($model,'firstName'),)); ?>[/size][/font][/color]



Then create the ActiveForm and it will use the rules from the Model




<div class="wide form">


<?php $form=$this->beginWidget('CActiveForm', array(

	'id'=>'location-form',

	'focus'=>array($model,'loc_name'),

	'enableClientValidation'=>true,


)); ?>


	<p class="note">Fields with <span class="required">*</span> are required.</p>


	<?php echo $form->errorSummary($model); ?>


	<div class="row">

		<?php echo $form->labelEx($model,'loc_name'); ?>

		<?php echo $form->textField($model,'loc_name',array('size'=>60,'maxlength'=>60)); ?>

		<?php echo $form->error($model,'loc_name'); ?>

	</div>


	<div class="row">

		<?php echo $form->labelEx($model,'loc_address'); ?>

		<?php echo $form->textArea($model,'loc_address',array('rows'=>3, 'cols'=>50,'size'=>60,'maxlength'=>200)); ?>

		<?php echo $form->error($model,'loc_address'); ?>

	</div>


	<div class="row buttons">

		<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?>

	</div>


<?php $this->endWidget(); ?>


</div><!-- form -->



thanks

can any body suggest me ,how to achieve client side validation(in javascript) in Yii?

I think the most simple solution would be just do it manually…

Yii forms helpfull in my opinion only in regular validation without ajax …

Could not find a good example that will convince my that I wrong

[size=2]For people who run on this question, after two years since asking it…[/size]

Starting from Yii 1.1.7, client-side validation in Javascript is build-in into framework. For more info or details – see CActiveForm.enableClientValidation.