JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old February 11th, 2007, 03:39 PM
tcustomgolf tcustomgolf is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2007
Location: NY
Posts: 1 tcustomgolf User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 m 25 sec
Reputation Power: 0
History.back() problem

I have a form on my site, that when filled out and submitted will validate things like email address, phone #, etc. If there is something amiss, a validation screen (new page) will appear with the errors found. I added a link there to go back to the form to make corrections using both javascript:window.history.back() and just javascript:history.back().

But when returning to the form, the form is blank using either of the above, and the user will have to fill the whole form out again. I know at one time the form data was sticking when retuning, but nothing has changed coding wise. This occurs in both IE and Firefox.

Any way to go back in history and keep form data?

Reply With Quote
  #2  
Old March 1st, 2007, 03:53 PM
Mittineague's Avatar
Mittineague Mittineague is offline
Contributing User
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jul 2005
Location: West Springfield, Massachusetts
Posts: 548 Mittineague User rank is Private First Class (20 - 50 Reputation Level)Mittineague User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Week 1 Day 6 h 35 m 44 sec
Reputation Power: 4
cookie?

Hi tcustomgolf, welcome to the forums,
I think the best way to solve this may be to set and read a cookie.
Initial page load, no cookie to read - inputs empty
on submit cookie set, user sent to validation page
on return to first page, cookie read - inputs use cookie values.

Reply With Quote
  #3  
Old March 1st, 2007, 09:06 PM
colton22's Avatar
colton22 colton22 is offline
\ ^_^ / - Moderator
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2006
Location: near chicago, Illinois
Posts: 472 colton22 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 1 h 14 m 46 sec
Reputation Power: 3
Send a message via AIM to colton22 Send a message via MSN to colton22 Send a message via Yahoo to colton22
i agree with Mittineague, the form data is stored by the browser normally so think of it this way, dont expect anything that happens in the browsers (dont take anything for granted) because it most likley is a feature of the browser itself.

colton22
__________________


Hang Out, Listen To Music, Have Fun, and Customize Your Experiance All In One Place! - Colton22's World - This is My World

Reply With Quote
  #4  
Old March 2nd, 2007, 01:39 AM
Psycho77 Psycho77 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2007
Posts: 4 Psycho77 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 48 sec
Reputation Power: 0
Try this:

Code:

	   out.println("<HTML><HEAD><title>JavaScriptExample</title>");
out.println("<SCRIPT LANGUAGE=JavaScript>");
out.println("function back() {");
out.println("history.back(-1);");
out.println("}");
out.println("</SCRIPT>");
out.println("</HEAD>");

...<some HTML>..

Reply With Quote
  #5  
Old March 2nd, 2007, 01:48 AM
Psycho77 Psycho77 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2007
Posts: 4 Psycho77 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 48 sec
Reputation Power: 0
Well, a very simple solution would be to send the user back to the form page
as if he pressed the back button in his browser, that will retain the form
items he filled out.

Like so:
Code:
<a href='javascript:window.history.back()'>Please correct your form</a>

Of course, you can have your JavaScript function do it like so:
Code:
setTimeout("window.history.back()",5000); // 5 second delay

Otherwise you would have to send data back to the original form page and
fill in the form items. You can send hidden form items from the validation
page back to the original form page, on the original page you would check if
those values are empty or zero for when the user goes there the first time.

See if the back method works for you, if it doesn't and you need more
detailed information (and code) on the other method I somewhat described
just ask.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJavaScript Development > History.back() problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway