I have a excel sheet that I need to replicate in JSP (using struts 1 framework). Now everything is done but I am stuck at the calculation part. As you might have seen in excel, some columns are calculations based on other columns.
So if I change field 'a', 'd' field should change automatically based on its formula (let's say, d=a*1.1 +b*2.1).
Now I tried to use the funstion in javascript where I read 'a' and 'b' values from JSP, then I calculate and everything works fine. But when I try to assign the calculation result for field 'd' in JSP throush javascript, 'd' does not change.
function adjustCalcs ()
{
var a = eval("document.form.al.value");
var b = eval("document.form.b.value");
var dCalc = ((a * 1.05) + (b * 1.1));
document.form.d.value = dCalc ; (this is where it should change the value of field 'd' in JSP, but ti won't...donno why?)
}
Or is there any better way to do these dynamic changes in JSP? Would appreciate the insight.
Thanks,
So if I change field 'a', 'd' field should change automatically based on its formula (let's say, d=a*1.1 +b*2.1).
Now I tried to use the funstion in javascript where I read 'a' and 'b' values from JSP, then I calculate and everything works fine. But when I try to assign the calculation result for field 'd' in JSP throush javascript, 'd' does not change.
function adjustCalcs ()
{
var a = eval("document.form.al.value");
var b = eval("document.form.b.value");
var dCalc = ((a * 1.05) + (b * 1.1));
document.form.d.value = dCalc ; (this is where it should change the value of field 'd' in JSP, but ti won't...donno why?)
}
Or is there any better way to do these dynamic changes in JSP? Would appreciate the insight.
Thanks,