How to calculate sum of few fields in Edit View?

Hi,
there are two possibilities: either the code itself does not work or it is not being loaded at all. I tested the js file shortly (using factory fields) and added some logging/casting:

$( document ).ready(function() {
console.log("custom js loaded");
$( "#name, #website" ).change(function() {
	var total = parseFloat($("#name").val()) + parseFloat($("#website").val());
	console.log("setting new total: " + total);
    $("#phone_fax").val(total);
  	});
});

when entering the EditView, you should see a line within the console (“custom js loaded”) and further messages appear when changing the name/website attributes.

1 Like