Taken from the Fusebox 3 core files:

<cfscript>
if (NOT IsDefined("attributes")) attributes=structNew();
StructAppend(attributes, url, "no");
StructAppend(attributes, form, "no");
</cfscript>

You can also use URL[VariableName] or Form[VariableName]

As in:

Attributes[Field] = Form[Field]

Steve

Steve Bryant.
Bryant Web Consulting LLC
http://www.BryantWebConsulting.com
http://steve.coldfusionjournal.com/

At 08:40 AM 3/16/2005, Bill Rawlinson wrote:
as a matter of consistency we move all URL and FORM parameters into
the Attributes scope and to do that we use evaluate - I would love to
know if there is a faster/better way of doing this - and likewise I am
defiately open to hearing why moving these variables into the
attributes scope might be a bad idea.

We move them there so that we reference everything in the same fashion
and the person working on the receiving end doesn't have to worry if
the data coming to them is via  URL or a FORM - they get a consistent
source, Attributes, for their passed data.

        <cftry>

                <cfset urlKeys = structKeyList(url)>

<cfloop list="#urlKeys#" index="thisKey">
<cfif NOT IsDefined("Attributes.#thisKey#")>
<CFSET SetVariable("Attributes.#thisKey#", Evaluate("url.#thisKey#"))>
</cfif>
</cfloop>



<cfif IsDefined("form.fieldNames")>
<cfloop List="#form.fieldNames#" Index="field">
<cfif not IsDefined("attributes.#field#")>
<cfset SetVariable("attributes.#field#", Evaluate("form.#field#"))>
</cfif>
</cfloop>
</cfif>


                <cfcatch type="any"></cfcatch>
        </cftry>


----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to 
[email protected] with the words 'unsubscribe cfcdev' as the subject of the 
email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting 
(www.cfxhosting.com).

An archive of the CFCDev list is available at
www.mail-archive.com/[email protected]



Reply via email to