Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

#Attributes#, FB3, and CF 1

Status
Not open for further replies.

ryanrat

IS-IT--Management
Oct 30, 2001
30
US
I've started using the Fusebox 3 methodology for coding our site, and I've run into a bit of a snag.

I've learned a lot of my fusebox knowledge from and in one of the tutorials on the site, it shows how a simple login page might be coded. They pass the Username and Password to a fuseaction. There, the query file "accepts" the information and then, in the query file they reference the Username and Password using #attributes.userName# and #attributes.password#, and I have no idea where the "attributes" came from.

I'm relatively certain that #attributes# has something to do with <cfparam>, but I'm not sure. Any help would be greatly appreciated.

Thanks in advance,

Rats
 
In FuseBox, all variables that are changed by the users within a Fusebox application should be scoped with: &quot;attributes.&quot; All Form. and URL. scoped variables to ATTRIBUTES. variables. There used to be a tag that did this <CF_FORMURL2ATTRIBUTES>, but in FB3 it's done automatically.

Why do this?

This is actually very important, because it allows an application to become both a standalone application and a CF Tag. Which is exactly what Fusebox applications are trying to accomplish.

The FB application will check and see if the user is requesting the application through a tag or as a standalone. If the application is being requested as a standalone (The Parent Application) it will convert all form. and url. variables to attributes. scoped variables. Then the Parent application can pass these values into child tags/applications. - tleish
 
I have read about <CF_FORMURL2ATTRIBUTES> because all I can find is documentation about FB2/FB1. I understand what you're talking about, and think I have it now.

I have this form:

<cfoutput>
<FORM NAME=&quot;selectUser&quot; ACTION =&quot;#self#fuseaction=#XFA.submitForm#&quot; METHOD=POST >
</cfoutput>
<table align=&quot;center&quot; cellspacing=&quot;2&quot; cellpadding=&quot;2&quot; border=&quot;0&quot;>
<tr>
<td align=&quot;center&quot;>
<select name=&quot;user&quot;>
<cfoutput query=&quot;allUsers&quot;>
<option NAME=&quot;UserID&quot; value=&quot;#usrID#&quot;>#coName# (#usrName#)</option>
</cfoutput>
</select>
</td>
</tr>
<tr>
<td align=&quot;center&quot;>
<input type=&quot;Submit&quot; value=&quot; OK &quot;>
</td>
</tr>
</form>


And this query:

<cfquery datasource=&quot;#request.dsn#&quot; name=&quot;updateUser&quot;>

SELECT
usrID, usrName, pass, coName, ctGiven, ctSurname, email
FROM
user
WHERE
usrID = #attributes.UserID#
</cfquery>


This seems to be working for me. Do you see anything inherently wrong with this?


I was trying to pass the Form variable in, but didn't know how to do it. I was trying to use the FORM scope, and it wasn't working. I then saw Hal Helm's example, and it puzzled me. Now that you have explained it to me, I understand how to use it, but am still hazy on the benefits. I'll try to find more resources on FB3.

Thanks for your time and help!

Ryan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top