Hello All,
I've created a form that has few Number fields and I'd like to create a sum of all those fields, how can I do that?
Thank you,
Edson
Hello All,
I've created a form that has few Number fields and I'd like to create a sum of all those fields, how can I do that?
Thank you,
Edson
Dear @edson.paula,
Hello! You can refer to this article for examples - Work with fields using JS on Plumsail Forms for SharePoint — SharePoint forms
In your case, you'll just need a few adjustments to calculate value for multiple fields, like this:
fd.spRendered(function() {
function calculateTotal() {
fd.field('Total').value = fd.field('Field1').value + fd.field('Field2').value + fd.field('Field3').value
}
// Calling calculateTotal when Field1 value changes
fd.field('Field1').$on('change',calculateTotal);
// Calling calculateTotal when Field2 value changes
fd.field('Field2').$on('change',calculateTotal);
// Calling calculateTotal when Field3 value changes
fd.field('Field3').$on('change',calculateTotal);
// Calling calculateTotal on form loading
calculateTotal();
});