Simply check for them with a mix of isDefined, isNumeric, etc. Also,
don't forget that you should probably also make sure that even if url.id
is a number, that it's a) greater than 0 and b) is a whole number
instead of something like 3.14. If you are doing a 'detail' page, you
also want to check that url.id references a record in the table that
actually exists, so, pseudo-code, my page may look like this:
<cfif url.id doesn't exist, or isn't a positive whole number above 1>
<cflocation someother page
</cfif>
<cftry>
<cfset data = myCFC.getTheCrap(url.id)>
<cfcatch>
The cfc will throw an error if ID doesn't exist, so
cflocate again.
This could easily be a cfquery as well, where you would
cflocate if
recordCount = 0
</cfcatch>
</cftry>
========================================================================
===
Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc
(www.mindseye.com)
Member of Team Macromedia (http://www.macromedia.com/go/teammacromedia)
Email : [EMAIL PROTECTED]
Blog : www.camdenfamily.com/morpheus/blog
Yahoo IM : morpheus
"My ally is the Force, and a powerful ally it is." - Yoda
> -----Original Message-----
> From: Neculai Macarie [mailto:[EMAIL PROTECTED]
> Sent: Monday, August 25, 2003 9:35 AM
> To: CF-Talk
> Subject: How to handle
>
>
> How do you handle missing required variables (like an id that
> is required to display some info about a product, or when the
> id is not numeric) ? I was thinking of something like an
> assert function, but I would like to know what others think.
>
> I'm using CF5.
>
> <mack />
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/lists.cfm?link=t:4
Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Get the mailserver that powers this list at
http://www.coolfusion.com