Watch out for the reserved event values in Model-Glue

So for the last 10 minutes or so I've been struggling with why Model-Glue was throwing an error about events. I have a controller that checks the value of "event" in the ViewState. This contains the name of the currently running event. For some reason, when I did one particular action, I got an error saying that the value of the event wasn't a simple value.

This certainly didn't make any kind of sense. Event had to be a simple value - otherwise - how would Model-Glue know what to run?

Turns out I was working on event editing (event as in calendar events). I had a line of code that did this:

<cfset arguments.event.setValue("event", createObject("component", "exchange.model.eventbean"))>

Yeah, um, not such a good idea. In case folks are curious, read this blog entry for a list of reserved words in Model-Glue.

Comments

This reminds me of a few hair-pulling issues I've encountered with reserved words! One that had me going crazy for several hours (the error I got was ridiculously obscure and nothing like the actual problem) was that I was trying to pass a "username" parameter in a <cfinvoke> tag, and CF was understanding it as a security/roles user name, not the string value I wanted. That ordeal taught me to use CreateObject() instead.
# Posted By Rachel | 5/22/07 4:58 PM
Of course, you could have done it with cfinvokeargument as well.
# Posted By Raymond Camden | 5/22/07 5:04 PM