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!

Cannot use cookies

Status
Not open for further replies.

programmher

Programmer
May 25, 2000
235
US
Is there any way to preserve form A's values when I get to it by using a "back" button on form B? I cannot use cookies.
 
There are two ways that I can think of...

1) use session variables

2) make the &quot;back button&quot; a mini form on form B with all the pertinent values on the page in hidden fields, the action button be the URL of page A, and a single submit button (with a value of &quot;<< BACK&quot;, or something like that).

At the top of Form A, put a bunch of CFPARAMs of all the variable names:
Code:
<CFPARAM name=&quot;FORM.variable1&quot; default=&quot;&quot;>
<CFPARAM name=&quot;FORM.variable2&quot; default=&quot;&quot;>
     :

And then the fields of Form A would simply plug those variables into their value parameters:

Code:
<cfoutput>
<input type=&quot;text&quot; name=&quot;variable1&quot; value=&quot;#FORM.variable1#&quot;><br />
<input type=&quot;text&quot; name=&quot;variable2&quot; value=&quot;#FORM.variable2#&quot;>
</cfoutput>

By using the CFPARAMs, if Form B is submitting the values to Form A, they'll appear in the text fields. If not, the text fields will be blank.


Hope it helps,
-Carl
 
Carl,

Thanks so much for your tip! I am implementing it now. I've discovered one anomoly - I keep getting commas in two of my text fields whenever I use my back button. Have you ever encountered this? If so, why and how can I eliminate these commas?
 
Commas (at least commas that you don't specific put in field values) generally mean that there's more than one form element (text, checkbox, radio button, etc) with the same name/id. Most browsers will conveniently concatenate the values in those elements as a comma-delimited list.

Don't know if that helps... but it's difficult to know for sure without more information.

Certainly one thing you could do as a workaround, if it turns out NOT to be multiple form elements with the same name, is the brute force method of:

Code:
<input type=&quot;text&quot; name=&quot;variable1&quot; value=&quot;#Replace(FORM.variable1,&quot;,&quot;,&quot;&quot;,&quot;ALL&quot;)#&quot;>

though I wouldn't recommend it for any number of reasons [wink]
Hope it helps,
-Carl
 
Carl,

Right again! That's exactly what was happening! Thanks for the insight and the assistance!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top