CActiveForm validation without resetting Javascript variables

I would like to validate a form created with the CActiveForm widget, and if validation fails, I would like to keep the Javascript variables. The reason is that I have Javascript variables that I am passing to the model through hidden form elements. When validation fails, then these Javascript variables are getting reset.

I have tried ‘enableAjaxValidation’=>true and ‘enableClientValidation’=>true and neither prevents the problem. Is there a way I can keep the Javascript variables if validation fails?

does your client side validation works

I tried the following and the Javascript variables are still being reset.




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

'id'=>'myform-form',

'enableClientValidation'=>true

)); ?>