In my last article, I talked about what I considered to be an odd side effect of using getValue on the event object. I really should have told folks how you can check for the existence of a value without actually doing the get. In other words, if all you want to do is see if the value exists, you should do this:
As opposed to getting it and checking if it is equal to “”. Of course, if you are building a form, then you need to do both, since it is possible then the value will exist and be blank.
<cfif arguments.event.valueExists("dharma") and arguments.event.getValue("dharma") neq "">
Something to keep in mind, and while I don’t like this strange behavour of getValue, I’ll definitely not forget now.
p.s. The ViewState has a similar API, but it uses viewState.exists() instead.