i working on pdf custom calculations.
below part of code giving me various issues:
var widowervalue = getfield("widowerallow").value; var widoweranswer = getfield("widowsenti").value; var widowerchildren = getfield("under18total01").value; var child01benefit = widowerchildren * 1620; var child01allowance = widowerchildren * 1534; if(widoweranswer == "yes"){ if(child01benefit != 0 && child01allowance !=0){ event.value = widowervalue + child01benefit + child01allowance; }else{ event.value = widowervalue; } } else if(widoweranswer == "no"){ if(child01benefit !=0){ event.value = child01benefit; } } this in textfield values change dependent on conditions met. works(sometimes), have click box , delete wrong value entered , show correct calculation. other times doesn't add values joins them e.g instead of 5 + 5 = 10(correct) place 5+5 = 55(wrong), again corrected when manually remove wrong value.
can offer insight why happening?
thanks
in js + operator concat strings , addition of integer.
string + string string concatination. number + number addition of numbers.
var string = '5'; function concat() { document.getelementbyid("result").innerhtml = string + string; } function addition() { document.getelementbyid("result").innerhtml = number(string) + number(string); } <div id='result'>click button</div> <button onclick="concat();">string concat</button> <button onclick="addition();">addition</button>
Comments
Post a Comment