I like to handle things like that somewhat gracefully, for example:
<!--- Default Parameters --->
<cfparam name="url.MyID" default="0" />
<!--- Get Data --->
<cfquery name="qryData">
SELECT ...
FROM ...
WHERE MyID = <cfqueryparam value="#val(url.MyID)#"
cfsqltype="cf_sql_integer" />
</cfquery>
<!--- Hmm... No records, send user back to list page --->
<cfif qryData.RecordCount is 0>
<cflocation url="index.cfm" addtoken="false" />
</cfif>
Essentially by using cfparam, if the value isn't there at all, it's
going to be defined as 0. Secondly, we're using cfqueryparam to protect
the database. Third, if the value of url.MyID is something odd, like a
string, it's going to be converted into a number. Finally, if there are
no records, it sends the user back to a list page.
Happy coding!
--
*Ryan J. Heldt*
/Senior Web Developer/
Global Reach Internet Productions
http://www.globalreach.com
Phone: 515-296-0792, Fax: 515-296-3748
[EMAIL PROTECTED] wrote:
> What the best approach to controling the error messages that appear when say
> for example, someone removes an integer from a url scope? For example, the
> url should pass idss=23 or whatever. If someone were to remove the 23 and
> get the standard CF error message. How can I prevent that message from being
> displayed and show a custom message?
>
> Thanks
>
> D
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:297140
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4