Exactly that:

<cfscript>
if (not isdefined ("attributes.x"))     {x = "";}
if (not isdefined ("attributes.y"))     {y = 0;}
if (not isdefined ("attributes.z"))     {z = "false";}
</cfscript>

If you need type checking its gets long winded:

<cfscript>
badVarList = "";
If (not isdefined("attributes.x") or not isnumeric(attributes.x)){
        listappend(badVarList, "attributes.x");
}
</cfscript>
<cfif len(badVarlist)>
        <cfabort showerror="You screwed up! Fix these: #badVarList#">
<cfelse>
        Insert bucket loads of code here.
</cfif>

Adam.

-----Original Message-----
From: Aidan Whitehall [mailto:[EMAIL PROTECTED] 
Sent: 31 March 2003 16:08
To: [EMAIL PROTECTED]
Subject: RE: [ cf-dev ] : [ cf-dev ] cfTag best practises template


> How do you setup a param a la CFPARAM using cfscript?

Isn't he suggesting using something like this:

<cfscript>
if (not IsDefined("attributes.x"))
   x = 1;
</cfscript>

?

-- 
Aidan Whitehall <[EMAIL PROTECTED]>
Macromedia ColdFusion Developer
Fairbanks Environmental Ltd  +44 (0)1695 51775

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

-- 
** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED] For
human help, e-mail: [EMAIL PROTECTED]


--
** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
For human help, e-mail: [EMAIL PROTECTED]

Reply via email to