Hi there,
I'm trying to update a total in a form while selecting individual values using a checkbox.
I have the following js:
function recalc(doc)
{
var total=eval("doc.detail.hiddentotal.value"
;
var amount=eval('doc.elements["Bal" + doc.name].value');
if (doc.checked == false) {
doc.detail.hiddentotal.value=eval(total)-eval(amount);
}
else {
doc.detail.hiddentotal.value=eval(total)+eval(amount);
}
return (eval("doc.detail.hiddentotal.value"
);
}
and the following form:
<form action="MailStatement.cfm?code=#url.code#" method="post" name="detail" id="detail">
.... form stuff...
<cfoutput query="qDetail">
.... query stuff ....
<td align="right">#dollarformat(qDetail.balance)#</td>
<td align="center"><input type="checkbox" name="#cSelectKey#" value="1" onclick="this.form.nTotal.value=recalc(this);" >
<input type="hidden" value="#qdetail.balance#" name="Bal#cSelectKey#"></td>
...more stuff...
...end of loop...
<input type="text" name="nTotal" value="#nTotal#">
<input type="hidden" name="hiddentotal" value="#ntotal#">
...end of form....
The result returned is undefined.
Can anyone tell me what I'm doing wrong or point me to detail FAQ w/examples on how to do this?
Tks/Rgds
__PC
I'm trying to update a total in a form while selecting individual values using a checkbox.
I have the following js:
function recalc(doc)
{
var total=eval("doc.detail.hiddentotal.value"
var amount=eval('doc.elements["Bal" + doc.name].value');
if (doc.checked == false) {
doc.detail.hiddentotal.value=eval(total)-eval(amount);
}
else {
doc.detail.hiddentotal.value=eval(total)+eval(amount);
}
return (eval("doc.detail.hiddentotal.value"
}
and the following form:
<form action="MailStatement.cfm?code=#url.code#" method="post" name="detail" id="detail">
.... form stuff...
<cfoutput query="qDetail">
.... query stuff ....
<td align="right">#dollarformat(qDetail.balance)#</td>
<td align="center"><input type="checkbox" name="#cSelectKey#" value="1" onclick="this.form.nTotal.value=recalc(this);" >
<input type="hidden" value="#qdetail.balance#" name="Bal#cSelectKey#"></td>
...more stuff...
...end of loop...
<input type="text" name="nTotal" value="#nTotal#">
<input type="hidden" name="hiddentotal" value="#ntotal#">
...end of form....
The result returned is undefined.
Can anyone tell me what I'm doing wrong or point me to detail FAQ w/examples on how to do this?
Tks/Rgds
__PC