|
|||||||
New to SitePoint Forums? Register here for free!
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
SitePoint Addict
![]() ![]() ![]() Join Date: Feb 2000
Location: Minnesota
Posts: 317
|
How can I prevent the forms from clearing when a user hits the back button?
I assume it has to do with cache control, but how do I prevent the form from clearing when a user hits the back button? The form I am referring to is my registration page. After the registration is submitted, they are taken to an error handling page. If an error comes up, they are required to hit the back button and correct the mistake.
It seems like for the most part it retains all of the information in the fields, but occasionally it clears it out. How can I prevent this? Thanks! ![]() |
|
|
|
|
|
#2 |
|
\m/ R.I.P. Dimebag! \m/
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Dec 2001
Location: erie, pa
Posts: 1,132
|
i don't bnelieve this isn't something you have programmatic control over and thus isn't a good method to use. i reccommend modifying your process so that the error message page has a link "back" to the registration screen which actually re-renders the page and populates the inputs with the values from the original form submittal.
|
|
|
|
|
|
#3 |
|
SitePoint Addict
![]() ![]() ![]() Join Date: Feb 2000
Location: Minnesota
Posts: 317
|
So, a link back to the registration page and the back button function in two different ways?
Thanks! |
|
|
|
|
|
#4 |
|
\m/ R.I.P. Dimebag! \m/
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Dec 2001
Location: erie, pa
Posts: 1,132
|
no its not a back button. you'd actually be going forward technically, although to the registration page again, but the second time the page is rendered, the input boxes are prepopulated with the values provided the first time the you were at the registration page.
Code:
<experiment_in_ascii_art>
your app:
registation.asp --> error.asp
^ |
| |
\--------------/
my suggestion:
registration.asp --> error.asp --> registration.asp?input1=value&input2=value&etc.
</experiment_in_ascii_art>
|
|
|
|
|
|
#5 |
|
SitePoint Wizard
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Feb 2001
Location: Pittsburgh, PA
Posts: 1,153
|
Haha...I guess that's the best type of diagrams we get
![]() |
|
|
|
|
|
#6 |
|
SitePoint Addict
![]() ![]() ![]() Join Date: Feb 2000
Location: Minnesota
Posts: 317
|
Thanks crowdozer!
|
|
|
|
|
|
#7 |
|
SitePoint Zealot
![]() ![]() Join Date: Feb 2002
Location: The High Country, Victoria, Australia
Posts: 190
|
Why create another step (or "click") when you don't need to?
May I suggest simply displaying the error message along with form? And if you want to make it super duper, mark the fields that have invalid entries with something eye catching so the user can immediately spot their mistake. I reckon specifying form border to something bright, ie red, would do the trick.
__________________
ride it like it's stolen |
|
|
|
|
|
#8 |
|
SitePoint Addict
![]() ![]() ![]() Join Date: Feb 2000
Location: Minnesota
Posts: 317
|
Funny you should say that...cuz after some thought, I re-did the entire page just like you mentioned. Hardest part was figuring out what error indication (in my case a red border around the field) was NS compatible as well.
Check out the finished work here. Just go down to the bottom and click the submit button without filling anything in. -Hideki |
|
|
|
|
|
#9 |
|
SitePoint Zealot
![]() ![]() Join Date: Feb 2002
Location: The High Country, Victoria, Australia
Posts: 190
|
Great minds... *g*
Good job Hideki.
__________________
ride it like it's stolen |
|
|
|
|
|
#10 | |
|
Phil
![]() ![]() ![]() ![]() ![]() ![]() Join Date: May 2002
Location: Jacksonville, FL
Posts: 1,171
|
Quote:
__________________
Jacksonville website design |
|
|
|
|
|
|
#11 |
|
SitePoint Addict
![]() ![]() ![]() Join Date: Feb 2000
Location: Minnesota
Posts: 317
|
Check out my link three posts up
|
|
|
|
|
|
#12 |
|
SitePoint Zealot
![]() ![]() Join Date: Feb 2002
Location: The High Country, Victoria, Australia
Posts: 190
|
fillup07, do you mean [how do you do it] technically?
__________________
ride it like it's stolen |
|
|
|
|
|
#13 |
|
SitePoint Wizard
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Aug 2000
Posts: 2,436
|
or... grab the form values using javascript and refresah the page plugging in the saved values
|
|
|
|
|
|
#14 |
|
SitePoint Addict
![]() ![]() ![]() ![]() Join Date: Jun 2000
Location: Texas, USA
Posts: 597
|
what I would do.
onError I would display a gif file next to the field. The gif file would show an arrow flashing between red and white/background color. I've only seen that in a few places and it's helped me catch mistakes much faster! imho. |
|
|
|
|
|
#15 |
|
SitePoint Zealot
![]() ![]() Join Date: May 2002
Location: New Zealand
Posts: 147
|
if you add a hidden field to your form, called for example submitted with a value of "0" or something then post the form back to itself and include this in your <% block%>
if request.form("Submitted")="0" then ' forms submitted strMessage="<ol>" validate form item oops error strMessage ="<li>you dim wit!</li>" blncheck = false if blncheck then ...forms ok so proceed end if strMessage = strMessage&"</ol>" end if <html> <%=strMessage%> |
|
|
|
|
|
#16 |
|
SitePoint Wizard
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Dec 2000
Location: Karachi, Pakistan
Posts: 913
|
You could always use session variables to save the information typed by the user. So in this way, even if he had to click the back button, the values would have been saved and would be displayed even if the page loaded.
![]() Just my 0.2! --Omair
__________________
36Host.com - $36/year web hosting [affiliates earn 30%] * Affordable Small Business Web Hosting since 2003! * "500mb space, 10gb bandwith, 50 pop/ftp accounts, php, mysql, pre-installed php scripts, 24/7 support & more...." |
|
|
|
![]() |
| Bookmarks |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
|
All times are GMT -7. The time now is 09:25.










Linear Mode
