>I have 2 cffunctions, one javascript function to call those 2, a checkbox to
>call javascript function onClick. I put a javascript between checkbox and
>cffunctions because I do not know how to call cffunction onClick. The
>problem is: everytime the screen refreshes, 2 cffunctions are called instead
>of 1 at a time depending on the checkbox checked or not. Any idea would be
>much appreciated....

The problem is that you can't call a cffunction from javascript (easily)
When a CF page is loaded, the cf server looks through the template for any cf 
tags within the script. 
When it gets to this bit

if(checkbox.checked) {
                temp = #increasetotal(session.finaltotal)#;                     
                
alert("checked");             } 
else if (!checkbox.checked){                         
temp = #decreasetotal(session.finaltotal)#;                         
alert("unchecked");             
}

the two cffunctions will be called irrespective of the javascript around it in 
order to replace whatever is between the #'s with the actual values returned by 
the functions.
Once cf has finished with the page, it is sent to the user as html. If you view 
the source of the page CF returns, you should see that the cffunction names 
have been replaced with the values returned when they were called on the server.

What you probably want to do is submit the form back to the server "onclick", 
then use coldfusion to check what the user selected and call the correct 
function.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:255010
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