rhodarose

10-17-2011, 03:54 AM

Hi!

I used javascript for my autocalculate and it works and now my problem is how can I SUM the total from autocalculate and the Data from other textbox.

here is my code:

function autocalearn(oText)

{

if (isNaN(oText.value)) //filter input

{

alert('Numbers only!');

oText.value = '';

}

var field, val, oForm = oText.form, TotEarn = a = 0;

for (a; a < arguments.length; ++a) //loop through text elements

{

field = arguments[a];

val = parseFloat(field.value); //get value

if (!isNaN(val)) //number?

{

TotEarn += val; //accumulate

}

}

oForm.TotEarn.value = TotEarn.toFixed(2); //out

}

</script>

The scenario is I have a Amount textbox and it has a value from database. And I have textboxes which is autocalculate and the total of that is display in total earn and now i want that the total earn and total amount will SUm and display in total earn..

<input name= "Amount" class = "LFieldTot" type="text" maxlength="12" tabindex="0" size="12" value="{$Amount}" readonly="readonly"/>

Thank you...

I tried to put {Amount} in Total Earn Values but when I insert data in the earnings textbox the data was the calculate from the textboxes, it did not sum the Amount.

I used javascript for my autocalculate and it works and now my problem is how can I SUM the total from autocalculate and the Data from other textbox.

here is my code:

function autocalearn(oText)

{

if (isNaN(oText.value)) //filter input

{

alert('Numbers only!');

oText.value = '';

}

var field, val, oForm = oText.form, TotEarn = a = 0;

for (a; a < arguments.length; ++a) //loop through text elements

{

field = arguments[a];

val = parseFloat(field.value); //get value

if (!isNaN(val)) //number?

{

TotEarn += val; //accumulate

}

}

oForm.TotEarn.value = TotEarn.toFixed(2); //out

}

</script>

The scenario is I have a Amount textbox and it has a value from database. And I have textboxes which is autocalculate and the total of that is display in total earn and now i want that the total earn and total amount will SUm and display in total earn..

<input name= "Amount" class = "LFieldTot" type="text" maxlength="12" tabindex="0" size="12" value="{$Amount}" readonly="readonly"/>

Thank you...

I tried to put {Amount} in Total Earn Values but when I insert data in the earnings textbox the data was the calculate from the textboxes, it did not sum the Amount.