Page 1 of 1

Result of SUM

Posted: Wed Aug 28, 2013 7:00 pm
by mpol_ch

Hello
I trying to get the sum of the following code in Startup Script in Add.

Betraege = 90
Leistungen: 87

The results is deliverd for "Vortrag == 0" 9087 and not 177. Where should I check it?

thanks.
mpol_ch
$("#x_Vortrag").change(function() {
if (this.value == "0") {
var val1 = $("#x_Betraege").val();
var val2 = $("#x_Leistungen").val();
var sum = val1 + val2;
$("#x_Endbestand").val(sum) ;
// Set value to field #2
} else {
$("#x_Endbestand").val("800"); // Set value to field #2
}
});


Re: Result of SUM

Posted: Wed Aug 28, 2013 7:06 pm
by mpol_ch

I am sorry webmaster. I just founded out the mistake. "+" is missing.

This code is working perfectly. You can delete the tread.
mpol_ch

$("#x_Vortrag").change(function() {
if (this.value == "0") {
var val1 = $("#x_Betraege").val();
var val2 = $("#x_Leistungen").val();
var sum = +val1 + +val2;
$("#x_Endbestand").val(sum) ;
// Set value to field #2
} else {
$("#x_Endbestand").val("800"); // Set value to field #2
}
});