I have javascript included in my form that I thought would display all currency fields in the $0.00 format; however, it is not working properly. An example would be that $115.00 is being displayed as $115 on the form. The form is being submitted by Workflow, and then routed to a user for verification and final edits. Once that user approves the form, both the original and another abbreviated version of the form are being saved to the repository (form saved with current process data). I have attached the javascript I am using. Some of the fields are formulas calculated by forms, some fields are filled in by Workflow on the initial submission. It doesn't seem to matter which way they are completed, they still do not display properly for me. We are running Forms 10.1.
Any help would be appreciated.
Thanks!
$(document).ready(function(){ //when any currency field input is changed, round the number to 2 decimal places $('.currency').change(function() { $(this).val(formatCurrency($(this).val())); }); function formatCurrency(value) { var float = parseFloat(value); return isNaN(float) ? 0 : (Math.round(float*100)/100).toFixed(2); } function roundDecimal(val, precision) { return (Math.round(Math.round(val * Math.pow(10, precision+1))/10)/Math.pow(10, precision)).toFixed(precision); } });