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

cfinclude refresh problem

Status
Not open for further replies.

Yelellav

Programmer
Feb 7, 2002
12
US
Does anyone know how to keep the value a user inputs into a textbox if the page refreshes. I have a couple of textbox's that the user enters values into. One of the fields is populated dynamically when the user clicks on the page that is displayed with cfinclude. When the user does this all of the previous information that they entered is lost. Is there a way to get the textbox to remeber the data entered?
 
You could save the value you want displayed in a session var:

<cfset session.saved = &quot;VALUE HERE&quot;>

When your page refreshes, the following will resolve.

<cfinput type=&quot;text&quot; size=20 maxlength=20 value=&quot;<cfoutput>#session.saved#</cfoutput>&quot;>

Hope it helps.

scripter73
Change Your Thinking, Change Your Life.
 
I think all pages containing forms should start with Attributes which pass the form field values to the form page, e.g.
<cfparam name=&quot;Attributes.Field1&quot; default=&quot;&quot;>
Then to display the form field you code e.g.
<input type=&quot;text&quot; name=&quot;Field1&quot; value=&quot;#Attributes.Field1#&quot;>
- N.B. you have to enclose this in CFOUTPUT tags to pick up the actual value from Attributes.Field1 and plug it inot the text box as displayed.

This enables the page which processes the form to set the value of Attributes.Field1, etc. then CFINCLUDE the form page to redisplay it.
 
philcha

I tried what you suggested but I couldn't get it to work. I am not sure how Attributes.Field1 will retain the value of the form field when the form is not submitted?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top