I'm still trying to flatten the learning curve on my first fusebox app and
have a question about using the cf_reuseform tag.

On a display page (dsp_usermain.cfm) I have a simple form to enter a
username and password and to select a company name for a user. Before
implementing the cf_reuseform tag, my fuseaction to call the form page in
index.cfm looked like this:

<cfcase value="usermain">
        <cfinclude template="qry_getcompinfo.cfm">
        <cfinclude template="dsp_usermain.cfm">  <== page with form in it
</cfcase>

Since implementing the cf_reuseform tag, I had to modify the case statement
to drop the include for the query from the case statement when using the
cfmodule call to the display template as such:

<cfcase value="usermain">
        <cfmodule template="dsp_usermain.cfm" Action = "new" FieldList =
"username,password">
</cfcase>

The dsp_usermain.cfm file now has a cfinclude call to qry_compinfo.cfm, plus
I added another cfinclude to a query template to get the usernames and
passwords. Dsp_usermain.cfm also calls the reuseform custom tag.

So when calling a template with a cfmodule in a case statement, the other
included files (in this case, the query file) for that fuseaction need to be
moved into the template called in the cfmodule, correct?

Now, the scenario for using the reuseform tag offers three options: new
(blank form), query (pre-fill a form from a query), and form (displayed
after a server-side validation on the form fields fails).  My second
fuseaction, "edituser", looks like this:

<cfcase value="edituser">
        <cfmodule template="dsp_usermain.cfm" Userid = #attributes.userid# Action =
"query" FieldList = "username,password">
</cfcase>

This works fine since I'm passing in a different "action" (query in this
case instead of new) and the userid as a primary key to get the user's info
to be pre-filled in the form.

My question now is, should this be a separate fuseaction the way I have it,
or is there a way to reuse the same fuseaction as above ("usermain") and
just pass in some other attribute that distinguishes the type of form to
display (blank, query)? If so, I can't figure out what it would be.

Lastly, when a server-side validation fails for the form values submitted,
does this require another separate fuseaction, or should the call to the
cfmodule happen in the template doing the validation?  If the former is true
(ie, a separate fuseaction called in index.cfm), then when using
cf_reuseform this requires three separate fuseactions in the index.cfm file
to handle all three situations for each form, correct?  If I'm off base
here, please help straighten me out.

Thanks,

Chris Montgomery             [EMAIL PROTECTED]

Web Development & Consulting http://www.astutia.com
Allaire Consulting Partner
210-490-3249/888-745-7603    Fax 210-490-4692
AIM: astutiaweb; ICQ: 7381282; Firetalk: Ag78


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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