modify form value with ajax

Hi,

I have a couple of forms in the view and they are related like

form A:price

form B:tax

and

form B = form A * tax rate(tax rate is defined in the constant, like 0.05%)

And value of form A is validated with ajax in real time.




if(isset($_POST['ajax']) && $_POST['ajax']==='price-form'){

	echo CActiveForm::validate($model);

	Yii::app()->end();

}



If someone input the number in form A, I wanna calculate the tax automatically and

put the result in Form B without erasing validate function.

But completely no idea how I can do it.

(This is so frustrated to take a meal 6 times a day.)

Please tell me the way to let my mind stable.

Guess make some code to modify json response…

Can you solve it?