Is it possible to use CJUIAutocomplete with custom validation rules?

I started off by writing my own validation rules. Following the tutorial, I created a class that extends CValidator and has a client validation method.

When I change the code in the view file to accommodate JUIAutocomplete, however, it seems that the client validation rules no longer run.

Is it possible to use both at the same time?

From:




        <div class="row">

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

		<?php echo $form->textField($model,'country',array('maxlength'=>120)); ?>

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

	</div>

To:




            <div class="row">

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

		<?php 

            $this->widget('zii.widgets.jui.CJuiAutoComplete', array

            (

                'name' => 'country',

                'source' => array('aruba', 'hazza', 'ac3'),

                // additional javascript options for the autocomplete plugin

                'options' => array(

                    'minLength' => '1',

                ),

                'htmlOptions' => array(

                    'maxlength' => 128,

                ),

            ));

        ?>

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

	</div>



I think you need to replace


'name' => 'country'

by


'attribute' => 'country',

'model'=>$model,

'value'=>$model->country

Yes, that worked perfectly. Thank you so much!