I don't use the reuseform tag. I do it manually with code adapted from the v
2 white paper. I've included a bit of text from our Developers Guidelines. I
hope this helps.
--Jeffrey
There are two parts to developing a form so it can be used three times. The
first part is in the form file (frm_) that contains the form. The following
code snippet defines six fields used in the form to create/read/update a
department. Depending on what fuseaction is passed from the index.cfm, the
appropriate New, Query, or Form processing will occur and the form field
values will be populated correctly. Notice that the field name values used
in the form will have a "wk" prefix. This stands for "work" and is only used
within the context of the form.
<cfset fieldlist =
"DeptName,FirstName,LastName,Title,WorkPhone,EmailAddress">
<cfswitch expression="#attributes.fuseaction#">
<!--- creating a brand new department --->
<cfcase value="new">
<cfloop index="fieldname" list="#fieldlist#">
<cfset temp = SetVariable("wk#trim(fieldname)#", "")>
</cfloop>
</cfcase>
<!--- editing an existing department --->
<cfcase value="query">
<cfinclude template="qry_getdeptcontact.cfm">
<cfloop index="fieldname" list="#fieldlist#">
<cfset temp = SetVariable("wk#trim(fieldname)#",
"#evaluate("qryGetDeptContact." & "#trim(fieldname)#")#")>
</cfloop>
</cfcase>
<!--- there was an error in the previous form submission --->
<cfcase value="form">
<cfloop index="fieldname" list="#fieldlist#">
<cfset temp = SetVariable("wk#trim(fieldname)#",
"#evaluate("attributes." & "#trim(fieldname)#")#")>
</cfloop>
</cfcase>
</cfswitch>
<form action="index.cfm" method="post">
<input type="hidden" name="fuseaction" value="savedept">
..
..
..
</form>
The second part of developing a form so it can be use three times is done in
the index.cfm for the circuit. Continuing the department example, one of the
case statements for the fuseaction must check for a fuseaction indicating
whether the user wants to create, edit, or save a department. The save
fuseaction will be invoked programmatically, if the form submission passes
the error checking.
<!--- work with department information --->
<cfcase value="newdept,editdept,savedept,thanksdept">
<cfswitch expression="#attributes.fuseaction#">
<!--- add a new department --->
<cfcase value="newdept">
<cfset error = "">
<cfset details = "">
<cfset attributes.fuseaction = "new">
<cfinclude template="frm_department.cfm">
</cfcase>
<!--- edit an existing department --->
<cfcase value="editdept">
<cfset error = "">
<cfset details = "">
<cfset attributes.fuseaction = "query">
<cfinclude template="frm_department.cfm">
</cfcase>
<!--- save the department --->
<cfcase value="savedept">
<cfinclude template="err_department.cfm">
<cfif len(error) GT 0 OR len(details) GT 0>
<cfset attributes.fuseaction = "form">
<cfinclude template="frm_department.cfm">
<cfelse>
<cfinclude template="cud_department.cfm">
<cflocation
url="index.cfm?fuseaction=thanksdept&deptid=#attributes.deptID#">
</cfif>
</cfcase>
<!--- thanks for the department submission --->
<cfcase value="thanksdept">
<cfinclude template="qry_getdeptcontact.cfm">
<cfinclude template="dsp_department.cfm">
</cfcase>
</cfswitch>
</cfcase>
-----Original Message-----
From: Tim Price [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 27, 2001 5:23 PM
To: Fusebox
Subject: A simple question !
Please forgive me for asking what will probably seem to all you gurus out
there a very simple question.
I got hold of Steve Nelsons book in the UK a few weeks ago and have been
structuring my CF accordingly.
However, I'm pulling my hair out trying to do some customised server side
validation on a form.
My form, included when fuseaction="editCode" and which uses the
<cf_reuseform> tag, redirects back to the circuit index file with
fuseaction="validatCode" like so.
<form action="index.cfm" method="post">
<input name="fuseAction" type="Hidden" value="validateCode">
Then the act_validateCode.cfm does some jigery pokery and depending on the
outcome
sets the following variables.
If validation failed
attributes.displayaction = "Form"
attributes.fuseaction = "editCode"
If validation OK
attributes.displayaction = ""
attributes.fuseaction = "updateCode"
before a URL directs the flow back to the circuit index.cfm
However, if the validation failed I cant get the information entered by the
user to re-display using <cf_reuseform> !!!!!!!!!
I know the answers out there.
Thanx in advance.
Tim
PS. Has anyone ever thought of coming over to the UK to do some Fusebox
trainning ?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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