How do I set this variable, then...
How do I set a variable in Javascript, then check for its value in CF? CFPARAM Name=JS Default=False script type=text/javascript var JS; JS = true; /script CFIF JS is true do something CFELSE do something else /CFIF Rick ~| Upgrade to Adobe ColdFusion MX7 The most significant release in over 10 years. Upgrade see new features. http://www.adobe.com/products/coldfusion?sdid=RVJR Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:275947 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: How do I set this variable, then...
you can't use CF to check for the existence of a JS variable. one of them is server side and one is client side. the JS variable is set after the page reaches the browser, at which point CF has done its job. On 4/20/07, Rick Faircloth [EMAIL PROTECTED] wrote: How do I set a variable in Javascript, then check for its value in CF? CFPARAM Name=JS Default=False script type=text/javascript var JS; JS = true; /script CFIF JS is true do something CFELSE do something else /CFIF Rick ~| Macromedia ColdFusion MX7 Upgrade to MX7 experience time-saving features, more productivity. http://www.adobe.com/products/coldfusion?sdid=RVJW Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:275948 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: How do I set this variable, then...
You'd have to use some form of behind the scenes processing. -Original Message- From: Rick Faircloth [mailto:[EMAIL PROTECTED] Sent: Friday, April 20, 2007 12:31 PM To: CF-Talk Subject: How do I set this variable, then... How do I set a variable in Javascript, then check for its value in CF? CFPARAM Name=JS Default=False script type=text/javascript var JS; JS = true; /script CFIF JS is true do something CFELSE do something else /CFIF Rick ~| Create Web Applications With ColdFusion MX7 Flex 2. Build powerful, scalable RIAs. Free Trial http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJS Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:275950 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: How do I set this variable, then...
AJAX ~| Upgrade to Adobe ColdFusion MX7 The most significant release in over 10 years. Upgrade see new features. http://www.adobe.com/products/coldfusion?sdid=RVJR Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:275955 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: How do I set this variable, then...
You can't. JS is client side and CF is server side, and never the two shall meet. You will have to send the JS value to the server with some kind of request. Either in the request of an entire page, as an URL value for example. Or with AJAX as a separate request. ~| Create Web Applications With ColdFusion MX7 Flex 2. Build powerful, scalable RIAs. Free Trial http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJS Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:275962 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: How do I set this variable, then...
Well can can cause coldfusion to set javascript variables based on coldfusion variables cfset foo = structNew() cfset foo.bar1 = 1 cfset foo.bar2 = 2 cfset foo.bar3 = 3 script language=javascript cfwddx action=CFML2JS input=#foo# toplevelvariable=foo alert(foo[bar1]); /script but the only way coldfusion will ever know what's in a javascript variable is via some kind of http request (like an AJAX call) And that won't occur until after the page has been completely processed by coldfusion. rick ~| Upgrade to Adobe ColdFusion MX7 Experience Flex 2 MX7 integration create powerful cross-platform RIAs http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJQ Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:275963 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: How do I set this variable, then...
Thanks for the responses, everyone! Rick -Original Message- From: Rick Root [mailto:[EMAIL PROTECTED] Sent: Friday, April 20, 2007 3:54 PM To: CF-Talk Subject: Re: How do I set this variable, then... Well can can cause coldfusion to set javascript variables based on coldfusion variables cfset foo = structNew() cfset foo.bar1 = 1 cfset foo.bar2 = 2 cfset foo.bar3 = 3 script language=javascript cfwddx action=CFML2JS input=#foo# toplevelvariable=foo alert(foo[bar1]); /script but the only way coldfusion will ever know what's in a javascript variable is via some kind of http request (like an AJAX call) And that won't occur until after the page has been completely processed by coldfusion. rick ~| Upgrade to Adobe ColdFusion MX7 Experience Flex 2 MX7 integration create powerful cross-platform RIAs http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJQ Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:275965 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: How do I set this variable, then...
Well can can cause coldfusion to set javascript variables based on coldfusion variables I like to describe this as building Dynamic JavaScript with CFML, just like CFML makes Dynamic HTML. It helps keep it clear in my mind that CF is building the JavaScript and once it is completely done it sends the whole kit and caboodle to the client. ~| Macromedia ColdFusion MX7 Upgrade to MX7 experience time-saving features, more productivity. http://www.adobe.com/products/coldfusion?sdid=RVJW Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:275966 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4