Hi,
I'm trying to figure out how to distinguish sums from separate tables. I have two tables on the same form and I'm using the following code from this link: https://www.laserfiche.com/support/webhelp/laserficheforms/9.0/en-us/forms/Content/CustomizingYourFormExamples.htm
The code looks like this
$(document).ready(function () {
$('.cf-table-block').on('blur', 'input', sumtotal);
if ($('.subtotal').length > 0) {
$('.cf-table-block').on('blur', 'input', rowtotal);
}
function sumtotal() {
var sum = 0;
$('td.sum').each(function () {
var s = 0;
$(this).find('input').each(function () {
s += parseNumber($(this).val());
})
$(this).find('.subtotal input').val(s);
sum += s;
});
$('.total input').val(sum);
}
function rowtotal() {
var sum = 0;
$('.cf-table-block tbody tr').each(function () {
var s = 0;
$(this).find('.sum input').each(function () {
s += parseNumber($(this).val());
})
$(this).find('.subtotal input').val(s);
sum += s;
});
}
function parseNumber(n) {
var f = parseFloat(n); //Convert to float number.
return isNaN(f) ? 0 : f; //treat invalid input as 0;
}
});
How would I distinguish the sums of both tables?
Here is a screenshot of the form so you can see what I'm doing.