ColdFusion code (CFML or cfscript) executes on the server.  it does
not respond to browser triggers such as onclick, onblur, etc.



On 10/2/06, vu nguyen <[EMAIL PROTECTED]> wrote:
> I realize my code is too long and not clear. This is the code after trimming 
> and commenting: (I use finaltotal array because string or number cannot be 
> passed by reference to cffunction)
>
> <cfdump var="#session.finaltotal#">
> <cffunction name="increasetotal" output="no" hint="update total">
>         <cfargument name="finaltotal" type="array">
>         <cfset temp1 = session.finaltotal[1] + 20>
>         <cfset ArraySet( ARGUMENTS.finaltotal,1,1, temp1 ) />
>         <cfreturn ARGUMENTS.finaltotal[1]>
> </cffunction>
> <cffunction name="decreasetotal" output="no" hint="update total">
>         <cfargument name="finaltotal" type="array">
>         <cfset temp2 = ARGUMENTS.finaltotal[1] - 10>
>         <cfset ArraySet( ARGUMENTS.finaltotal,1,1, temp2 ) />
>         <cfreturn ARGUMENTS.finaltotal[1]>
> </cffunction>
>
> <!--Javascript function to be called onClick -->
> <script>
> <cfoutput>
> function hello(checkboxes, index)
> {
>         checkbox = checkboxes[index];
>         if(!checkbox) {
>                 checkbox = checkboxes;
>         }
>         var temp = 0;
>         if(checkbox.checked) {
>                 temp = #increasetotal(session.finaltotal)#;
>         } else if (!checkbox.checked){
>                 temp = #decreasetotal(session.finaltotal)#;
>         }
>         window.location.reload();
> }
> </cfoutput>
> </script>
>
> <!--HTML containing checkbox -->
> <html><head><title></title></head>
> <body>
> <cfoutput>
> <cfform NAME="listForm" METHOD="POST"
> ACTION="http://www.annistonmorningrotary.org/temp/confirmpremium.cfm";>
> <table border=1>
> <tr><td><cfinput type="checkbox" name="chosenSite" value="1" 
> onclick="javascript:hello(document.listForm.chosenSite, 0);"/>
> </table>
> </cfform>
> </cfoutput>
> </body>
> </html>
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:255012
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to