Didn't even notice that. That would be it. -----Original Message----- From: James Holmes [mailto:[email protected]] Sent: Sunday, May 30, 2010 12:03 AM To: cf-talk Subject: Re: "This expression must have a constant value" error
No, it's not the switch expression that's the problem, it's the case: <cfcase value="#session.UserID#"> >From the documentation (http://cfquickdocs.com/cf8/?getDoc=cfcase): "The value or values must be simple constants or constant expressions, not variables." mxAjax / CFAjax docs and other useful articles: http://www.bifrost.com.au/blog/ On 30 May 2010 11:11, Alan Rother <[email protected]> wrote: > > Im assuming it's coming from the switch itself > > <cfswitch expression="#Games.GameMasterID#"> > > Games.GameMasterID is a query result, correct? You can't set the switch > expression directly to a query result, as there may be one or many results. > You can set a separate variable based on the result then use it as the > switch expression: > > <cfset variables.mySwitchVal = Games.GameMasterID> > <cfswitch expression="#variables.mySwitchVal#"> > > > =] > > On Sat, May 29, 2010 at 9:09 AM, Phillip Vector > <[email protected]>wrote: > > > > > I have the following code... Why am I getting a "This expression must > > have a constant value." error? I looked online, but I didn't find > > anyplace that explained it clearly. > > > > <cfinclude > > template="qry_CheckRSVP.cfm"> > > <cfswitch > > expression="#Games.GameMasterID#"> > > <cfcase > > value="#session.UserID#"> > > > > GMing > > </cfcase> > > <cfcase > > value="999"> > > No > > GM Yet > > </cfcase> > > > > <cfdefaultcase> > > > > <cfoutput> > > > > <cfif CheckRSVP.Recordcount EQ 0> > > > > <form method="post" action="#myself#Schedule.Signup"> > > > > <input type="Submit" class="submit" Name="Submit" > > value="RSVP"> > > > > </form> > > > > <cfelse> > > > > <form method="post" action="#myself#Schedule.Delete"> > > > > <input type="Submit" class="submit" Name="Submit" > > value="Remove RSVP"> > > > > </form> > > > > </cfif> > > > > </cfoutput> > > > > </cfdefaultcase> > > </cfswitch> > > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:334121 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

