> -----Original Message-----
> From: paul smith [mailto:[EMAIL PROTECTED]]
> Sent: Monday, March 26, 2001 1:03 PM
> To: Fusebox
> Subject: RE: Musings on Attributes (was Best Practices...)
>
>
> Could you put the query in attributes' scope: attributes.MyQuery ?
>
> Would this save a copy? You could just refer to
> attributes.MyQuery.firstname
>
> best, paul
Paul,
That's EXACTLY what I do. :)
But I only do that for queries that return multiple records. (I
should say can/usually return multiple records.)
For queries that return one record only, I make sure to copy
the results individually to the attributes scope, and I don't
mind doing it by hand.
The reason for this is it maxmizes reusability. For example,
consider the way I handle forms. In a typical form, I might
have something like this.
<cfparam name="attributes.username" default="">
<form ...>
....
<input type="text" name="username" value="#attributes.username#">
....
<input type="submit" ...>
</form>
If I'm using the form to add a new record, the cfparam sets the
default value on the form to nothing. If I'm editing a record,
either because of a qry_ file or some other method, the value
of attributes.username has already been set.
I think this is basically the same thing as CF_Reuseform does,
but I find it to be simpler, clearer, and more flexible.
I like not being able to not worry about whether a parameter
is in URL, FORM, ATTRIBUTES, or a QUERY. Everything goes back
into ATTRIBUTES, so everything comes out of ATTRIBUTES. (I
would rather everything go into/out of VARIABLES, but that's
another story.)
Patrick
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists