Anyone see any issue bad practise in this it check attributes...
Call function...
CheckAttribute
(
"Name",
"yes",
"Must specify a name",
"com.mycompany.Error.MissingTagAttribute.Name"
);
the function
<cffunction name="CheckAttribute">
<cfargument name="VariableName" required="yes" type="String" />
<cfargument name="Required" required="yes" type="String" />
<cfargument name="Message" required="yes" type="String" />
<cfargument name="ThrowError" required="yes" type="String" />
<cfif (Arguments.Required IS "YES")>
<cfif NOT isDefined("Attributes.#VariableName#") >
<cfthrow type="#ThrowError#" message="#Message#">
<cfexit />
<cfreturn true/>
</cfif>
</cfif>
</cffunction>
Of course you chould add param defaults, and validation etc..
Justin
-----Original Message-----
From: Dave Phipps [mailto:[EMAIL PROTECTED]
Sent: 31 March 2003 16:02
To: [EMAIL PROTECTED]
Subject: [notspam] RE: [ cf-dev ] : [ cf-dev ] cfTag best practises
template
How do you setup a param a la CFPARAM using cfscript?
MTIA
Dave
At 15:21 3/31/2003 +0100, you wrote:
>I would avoid using cfparams and use cfscript instead. It requires a
>fair bit more coding but CFPARAM is very slow.
>
>Adam.
>
>-----Original Message-----
>From: Steve Martin [mailto:[EMAIL PROTECTED]
>Sent: 31 March 2003 14:03
>To: [EMAIL PROTECTED]
>Subject: RE: [ cf-dev ] : [ cf-dev ] cfTag best practises template
>
>
>Use a CFPARAM DEFAULT for params that you can assume a trivial default
>value for and CFPARAM TYPE for attributes that are required.
>
>For tags that pass back a value to the caller, allow the tag to be
>called with an attribute which contains the name of the result to be
>placed in the caller scope.
>
>Comment code clearly (though we all do this all the time anyway, yes!
>;-] )
>
>Steve
>
> > -----Original Message-----
> > From: Alex Skinner [mailto:[EMAIL PROTECTED]
> > Sent: 31 March 2003 13:19
> > To: [EMAIL PROTECTED]
> > Subject: RE: [ cf-dev ] : [ cf-dev ] cfTag best practises template
> >
> >
> > Never really seen a best practices doc for cf tags
> >
> > I know the CF Advanced training material mentions that
> > required attributes
> > should be checked for
> > and the list of attributes should be compared to expected
> > attributes so that
> > the user recieves an error if they pass
> > in an attribute the tag doesn't understand.
> >
> > Part from that just general best practices I suppose.
> >
> > Dug out an example comment from some docs part from that not sure
> >
> > Seans guide for the rest maybe
> >
> > <!---
> > AUTHOR:
> > DATE:
> > PURPOSE:
> > ATTRIBUTES:
> > Name="..." -required
> > USAGE NOTES:
> > <cf_foo name="value">
> > MODIFICATION LOG:
> > DATE AUTHOR MODIFICATION
> > ==== ======= ================================
> > --->
> >
> >
> > Alex
> > -----Original Message-----
> > From: Justin MacCarthy [mailto:[EMAIL PROTECTED]
> > Sent: 31 March 2003 12:33
> > To: [EMAIL PROTECTED]
> > Subject: [ cf-dev ] : [ cf-dev ] cfTag best practises template
> >
> >
> > > What is it that you think you're doing badly? ;o)
> >
> > LOL
> >
> > > > Stephen
> > > > Just out of interest, does anyone know of a "best
> > practise" custom cfml
> > > > tag template???
> > > >
> > > I don't remember ever having seen a best practices for
> > custom tags, just
> > > general CF ones.
> >
> > Yeah, I don't think I have either. Lots of general cf coding
> > style, and
> > Seans guidelines has some stuff, mostly var naming guidelines
> >
> > Just want to make sure the tags I'm written are best practise.
> >
> > Thanks
> > Justin
> >
> >
> > --
> > ** 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]
> >
> >
>
>--
>** 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]
--
** 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]