Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

using toFixed in javascript in tabular form

dianapAug 10 2012 — edited Aug 10 2012
Hi all,

I have a tabular form with a javascript calculation on a column.
Column 9 = column 5 * column 7 
See below the javascript (onchange):
<script language="JavaScript" type="text/javascript">
<!--
function calcit(pThis)
{
var vRow = pThis.id.substr(pThis.id.indexOf('_')+1);


document.getElementById('f09_'+vRow).value = document.getElementById('f05_'+vRow).value* document.getElementById('f07_'+vRow).value;


}
//-->
</script>
The columns are of number format 5,234.10

Users now have the abbilty to enter number like 5,234.10455 etc.
The calculation is then done on based on what the user has entered.
But I want the calculation to be done based on 2 decimals (just like the number format specified).

I read that this can be done with toFixed.
Where in my code should i put the toFixed?
I tried putting it like this document.getElementById('f07_'+vRow).value.toFixed(2), but then my javascript calculation no longer calculates.

I could really appreciate some help on this.

Thanks,
Diana

Edited by: dianap on Aug 10, 2012 8:06 AM
This post has been answered by Erick Diaz on Aug 10 2012
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 7 2012
Added on Aug 10 2012
1 comment
280 views