I'm trying to total up values in a form, next to each value there's a checkbox which 
indicates whether to use the displayed value or not in the total.
I was hoping someone could point me to a solution:

I have a javascript:

function recalc(whichbox)
{
        with (whichbox.form)
        {
        if (whichbox.checked == false)
                        { hiddentotal.value = eval(hiddentotal.value) - 
eval(whichbox.value); }
                else    { hiddentotal.value = eval(hiddentotal.value) + 
eval(whichbox.value); }
        }
        return(hiddentotal.value);
}


and a form:

<form action="MailStatement.cfm?code=#url.code#" method="post" name="detail" 
id="detail">
        ..... form stuff.....
        <cfoutput query="qDetail">
        <td align="right">#dollarformat(qDetail.balance)#</td>                         
                 
        <cfset cSelectKey="ID"&trim(qDetail.id)>        
        <td align="center"><input type="checkbox" name="#cSelectKey#" value="1" 
onclick="this.form.nTotal.value=recalc(this);"></td>            
        <td align="right" colspan=6><input type="text" name="nTotal" 
value="#nTotal#"></td>

        <input type="hidden" name="hiddentotal" value=0>
        .... more stuff.....
</form>

How can I make this work so that nTotal is recalculated with qDetail.balance depending 
on the checkbox state?

Tks/Rgds

 
Paolo Cesana    
IT Development Mgr.
"Electricity is not the result of a series of upgrades to the candle"
Auth. unknown


Miami International Forwarders (MIF)

Phone: (305)594-0038 Ext. 7326
Fax: (305)593-0431
<mailto:[EMAIL PROTECTED]>
<http://www.mif.com/>

______________________________________________________________________
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to