Alex Rivera | Logout

In ColdFusion, how do I determine if a query string variable exists?

Asked 2010-02-25T23:38:03.153
11

In ColdFusion, how can I determine if a variable exists within the querystring without throwing an error attempting to check it?

Edit
Report

1 Answer

1

I have used this approach in many places.

At the top of the page:

<cfparam name="request.someVal" default="request.defaultVal">

Later in the page or custom tag, check for the value of the request.someVal variable, without fear of it crashing, since it has a default value.

<cfif ("request.someVal" eq "something")>
    ...
</cfif>
.
.
.
answered 2011-12-15T18:26:35.510

Your Answer