My example left out the default. If a CFPARAM exists with a name but no default, it throws an error if the variable does not exist. i.e. it's saying that the variable has to exist. If I read your idea right, any error will result in the default being used so if myID is a string, rather than an error we'll get a value of 0 for the variable. My idea makes the handling of the error something that can be coded where your approach forces a default value on error. It also doesn't address when the tag is used without a default.
I actually have to email you. I moved your mail to a "must reply" folder which is top of my list to do. Tonight (and thanks). :) >I had a similar idea ages ago except I think that the setting of the var >should still happen if the type check fails. > ><cfset myID = "not an ID, a string!"> > ><cfparam name="myID" type="numeric" default="0"> > ><!--- By here myID would be 0 and no error thrown ---> > >Adrian > >P.S. Did you get my last few emails Mike? I sent the files and a follow-up >email but no reply. > >-----Original Message----- >From: Michael Dinowitz [mailto:[EMAIL PROTECTED] >Sent: 14 February 2006 20:12 >To: CF-Talk >Subject: [OT] Future CF Features > > >This is a follow up from another post about what happens when someone >removes the ?wsdl from a web service CFC. I'd like to have my first request >be either an admin setting or something else to redirect or choose where to >go when a .cfc is loaded directly in an url without any passed variables. > >The second request deals with CFPARAM with the type attribute set. If this >fails, an error is thrown. In order to deal with the error, the CFPARAM tag >has to be within a try/catch. If we know an error may be thrown from this >tag, why not give the tag the ability to deal with the error. >My suggestion is to keep the tag as is but add the ability to put a closing >CFPARAM tag. What will be placed between the start and end CFPARAM tags is >the code that will be run if there is an error. ><CFPARAM name="id" type="numeric"> >error processing code here to deal with the the id not existing or not being >numeric ></CFPARAM> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:232268 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54