I was editing some code, trying to make it more efficient and secure.  I was
going through wrapping all URL variables in Val() functions and all text in
Trim() functions .. etc.  I looked at a page that had about 45 Val() and
Trim() functions all over it and thought "that's a lot of functions to be
having to run all over the place".  Then it hit me .. At the top of each
page that receives such data, after you <cfparam> any variables that might
have been left blank, the next step should be a list of code such as this:

<cfparam name="URL.variable" default="0">
<cfparam name="Form.txtVariable1" default="">
<cfparam name="Form.txtVariable2" default="">

<cfset URL.variable = #Val(Trim('URL.variable'))#>
<cfset Form.txtVariable1 = "#Trim('Form.txtVariable1')#">
<cfset Form.txtVariable2 = "#Trim('URL.txtVariable2')#">

Now you can just use your variables like normal without having to worry
about tossing functions all over the place.  I know it sounds really basic
and simple, but it just hit me .. and I was like DUH!  I just figure it
might help someone else out :)

Anyway .. thanks for being amazed at my moment of pure genius! ;)

Todd Ashworth


------------------------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message 
with 'unsubscribe' in the body to [EMAIL PROTECTED]

Reply via email to