I wrote that new one because the old one didn't really add them into the
attributes structure at all. What it did was just prefix "attributes." to a
variable name. The variable was still local. If you looped over the
attributes structure, it was nowhere to be seen. CF currently lets you
create variable names with periods in them, so this is a local variable:
<cfset XFA.onSubmitForm = "mainMenu"> My understanding is that this is going
to be deprecated in upcoming releases of CF.

Hal Helms
Team Allaire
[ See www.halhelms.com <http://www.halhelms.com>  for info on training
classes ]


-----Original Message-----
From: Robert Everland [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 15, 2001 10:26 AM
To: CF-Talk
Subject: FW: New formURL2Attributes.cfm


-----Original Message-----
From: Tim Kearsey (Esense Limited) [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 15, 2001 9:46 AM
To: '[EMAIL PROTECTED]'
Subject: New formURL2Attributes.cfm


I got this from [EMAIL PROTECTED], can't find it at www.fusebox.org.
It only works on CF 4.5+.
Got it on live servers and it's very stable.
It runs in 10ms, the old one was taking about 150ms.

Tim

<cfsilent>
        <!--- This tag will turn all 'Form' and 'URL' scoped variables into
'Attributes' scoped
        variables.  This allows you to have a common scope of variables,
thus allowing you to
        call the entire application i.e. index.cfm as a CFMODULE or as a
regular application.
        Designed for: CF 4.5+ --->
        <cfif not isdefined('caller.attributes')>
                <cfset caller.attributes=structnew()>
        </cfif>
        <cfif NOT StructIsEmpty(url)>
                <cfif StructIsEmpty(caller.attributes)>
                        <cfset caller.attributes=structcopy(url)>
                <cfelse>
                        <cfloop collection="#url#" item="urlname">
                                <cfif not StructKeyExists(caller.attributes,
urlname)>
                                        <cfset caller.attributes[urlname] =
url[urlname]>
                                </cfif>
                        </cfloop>
                </cfif>
        </cfif>
        <cfif NOT StructIsEmpty(form)>
                <cfif StructIsEmpty(caller.attributes)>
                        <cfset caller.attributes=structcopy(form)>
                <cfelse>
                        <cfloop collection="#form#" item="field">
                                <cfif not StructKeyExists(caller.attributes,
"urlname")>
                                        <cfset
caller.attributes[field]=form[field]>
                                </cfif>
                        </cfloop>
                </cfif>
        </cfif>
</cfsilent>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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

Reply via email to