sjgrodriguez
Posts: 26
|
Posted: 02/10/2012, 10:06 AM |
|
Hi there. I have an editable grid with three textboxes called VALOR_PPM, DILUCION and RESULTADO
With Javascript, i want to calculate the value of the RESULTADO textbox based on the formulae: PPM * DILUCION .
My javascript code is:
<script language="javascript">
function fadd()
{
var uno,dos,resultado_final;
uno=parseFloat(document.Tasks.VALOR_PPM.value.replace(/,/gi, '.'));
//Take the value of second textbox and convert it to float
dos=parseFloat(document.Tasks.DILUCION.value.replace(/,/gi, '.'));
resultado_final=(uno*dos);
resultado_final = resultado_final.toString()
var myNewString = resultado_final.replace(".", ",");
//show the result in the result textbox
document.Tasks.RESULTADO.value=myNewString;
}
</script>
Also i have set the Onchange Event "fadd(this)" for the textboxes VALOR_PPM and DILUCION.
It works great when the editable grid has only one row. However, if it has two or more rows, it doesnt work. Actually, it does nothing.
How can i do to make this code work with multiple rows in an editable grid?
I have tried many things, with no success.
I hope that someone can help me.
Thanks in advance,
Sergio Gómez
|
|
|
|