Calculated total not saving to DB

Initial syntax observation - add a ‘;’ after+ val3 and move the value assignment to the next line…

var ans = val1 + val2 + val3;
$w("#answer").value = String(ans);

Now if your button2 element is bound to the dataset Submit function then it is probably firing before you assign the ans to $w(‘#answer’) element. You may want to unbind the button and use $w(‘#’).save() instead?