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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Entering prefilled information using Fusebox

Status
Not open for further replies.

iao

Programmer
Feb 23, 2001
111
US
I have a form where I run a lot of error checking. If, when pressing submit, the user recieves an error, I would like to redraw all of the entered values on the form, without forcing the user to retype in the values over again.

On my form, I create an array of default values upon entry. Then, if the user selects a specific value from a drop down list, I remove the default values and insert the values from the selected item.

Here is my problem. I am using Fusebox, and I am passing my variables through the URL method. So, for instance, if an error occurs, I would use something like the following:

<CFLOCATION URL=&quot;index.cfm?fuseaction=Project&Error=Please type in a name.&quot;>

This works well. But, if I want to display all the values entered by the user when an error occurs. I don't know the correct way in doing so. The only way I know how would be to do something like:

<CFSET ErrorName = #attributes.name#>
<CFSET ErrorID = #attributes.ID#>
<CFSET ErrorPhone = #attributes.phone#>

Then, on my display page, if an error occurs, the value of the text box would be those above values. The problem with this is that my URL varialbe would get a bit long (I would have 10 variables in the URL string so it would be 3 or 4 lines long). This just doesn't seem like it would be the right way to do it.

Any ideas?
 
I try to avoid <CFLOCATION> when trying to validate forms. Here's a basic example of something I would do when trying to validate a form.

[COLOR=666666]<!--- index.cfm (fusebox file) --->[/color]
<CFSWITCH EXPRESSION=&quot;#ATTRIBUTES.fusebox#&quot;>
[COLOR=666666]<!--- Validate form --->[/color]
<CFCASE VALUE=&quot;validate&quot;>
<CFINCLUDE TEMPLATE=&quot;act_validate.cfm&quot;
</CFCASE>


[COLOR=666666]<!--- Submit form --->[/color]
<CFCASE VALUE=&quot;submit&quot;>
<CFINCLUDE TEMPLATE=&quot;act_submit.cfm&quot;>
<CFLOCATION URL=&quot;index.cfm?fuseaction=success&quot;>
</CFCASE>

[COLOR=666666]<!--- Display Success page --->[/color]
<CFCASE VALUE=&quot;success&quot;>
<CFINCLUDE TEMPLATE=&quot;dsp_success.cfm&quot;>
</CFCASE>

[COLOR=666666]<!--- Display default form --->[/color]
<CFDEFAULTCASE>
<CFINCLUDE TEMPLATE=&quot;dsp_form.cfm&quot;
</CFDEFAULTCASE>


</CFSWITCH>

[COLOR=666666]<!--- dsp_form.cfm --->[/color]
[COLOR=000080][COLOR=CC3300]<FORM ACTION=&quot;index.cfm?fusebox=validate&quot; METHOD=&quot;post&quot;>[/color][/color]


[COLOR=666666]<!--- act_validate.cfm --->[/color]
[COLOR=000080]<VALIDATE CODE>[/color]

<CFIF CODE IS &quot;valid&quot;>
[COLOR=666666]<!--- Reset fusebox variable to submit the form --->[/color]
<CFSET ATTRIBUTES.fusebox = &quot;submit&quot;>
[COLOR=666666]<!--- Re-include fusebox file --->[/color]
<CFINCLUDE TEMPLATE=&quot;index.cfm&quot;>
<CFELSE>
[COLOR=666666]<!--- Reset fusebox variable to re-include the form page --->[/color]
<CFSET ATTRIBUTES.fusebox = &quot;&quot;>
[COLOR=666666]<!--- Re-include fusebox file --->[/color]
<CFINCLUDE TEMPLATE=&quot;index.cfm&quot;>
</CFIF> - tleish
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top