calcul between fields

Hi there…

I have the folowing form which I want to use to calculate taux*mtht and put it in mttva with ajax but I don’t know how to do this please help me.

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

'id'=&gt;'factureachats-form',


'enableAjaxValidation'=&gt;true,

)); ?>

&lt;div class=&quot;row&quot;&gt;


	&lt;?php echo &#036;form-&gt;labelEx(&#036;model,'taux'); ?&gt;


	&lt;?php  echo &#036;form-&gt;dropDownList(&#036;model,'taux',&#036;taux , array('id' =&gt; 'taux',

‘empty’=>’–select–’, ‘onchange’=>‘validate_dropdown()’)); ?>

	&lt;?php echo &#036;form-&gt;error(&#036;model,'taux'); ?&gt;


&lt;/div&gt;





&lt;div class=&quot;row&quot;&gt;


	&lt;?php echo &#036;form-&gt;labelEx(&#036;model,'mtht'); ?&gt;


	&lt;?php echo &#036;form-&gt;textField(&#036;model,'mtht',array('id' =&gt; 'mtht')); ?&gt;


	&lt;?php echo &#036;form-&gt;error(&#036;model,'mtht'); ?&gt;


&lt;/div&gt;





&lt;div class=&quot;row&quot;&gt;


	&lt;?php echo &#036;form-&gt;labelEx(&#036;model,'mttva'); ?&gt;


	&lt;?php echo &#036;form-&gt;textField(&#036;model,'mttva',array('id' =&gt; 'mttva')); ?&gt;


	&lt;?php echo &#036;form-&gt;error(&#036;model,'mttva'); ?&gt;


&lt;/div&gt;





&lt;div class=&quot;row&quot;&gt;


	&lt;?php echo &#036;form-&gt;labelEx(&#036;model,'mtttc'); ?&gt;


	&lt;?php echo &#036;form-&gt;textField(&#036;model,'mtttc'); ?&gt;


	&lt;?php echo &#036;form-&gt;error(&#036;model,'mtttc'); ?&gt;


&lt;/div&gt;





&lt;div class=&quot;row buttons&quot;&gt;


	&lt;?php echo CHtml::submitButton(&#036;model-&gt;isNewRecord ? 'Create' : 'Save'); ?&gt;


&lt;/div&gt;

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

I find the solution it’s very simmple by using JS as folowing

	&lt;?php echo &#036;form-&gt;textField(&#036;model,'mtht',array('id' =&gt; 'mtht','onChange'=&gt;&quot;document.getElementById('mttva').value=parseFloat(this.value*document.getElementById('taux').value)/100;document.getElementById('mtttc').value=parseFloat(this.value)+parseFloat(document.getElementById('mttva').value);&quot;)); ?&gt;