Howdy folks,
Working with LF Forms 9.2 and Javascript. Creating a PO forms which looks pretty standard...
Here's the JS I'm using, pulled it from another Answer thread..
$(document).ready(function () {
$('.cf-table-block').on('blur', 'input', sumtotal);
function sumtotal() {
var sum = 0;
$('.cf-table-block tbody tr').each(function () {
var s = 0;
s = parseNumber($(this).find('.price input').val()) * parseNumber($(this).find('.quantity input').val());
$(this).find('.subtotal input').val(s);
sum += s;
sum += parseNumber($('.tax input').val()) + parseNumber($('.shipping input').val());
});
$('.total input').val(sum);
}
function parseNumber(n) {
var f = parseFloat(n); //Convert to float number.
return isNaN(f) ? 0 : f; //treat invalid input as 0;
}
});
Odd things happens with the multiplication with certain numbers, like multiples of 3 when the Unit Cost is 5.1, 5.2, ect.
Any idea what's going on..?