sunilvadranapu Posted May 8, 2008 Share Posted May 8, 2008 Hi, i am using history.back() method to go back to previous page. the problem is data i entered in the page is not retain when i click back button. whats the problem. thanks in advance. -sun Quote Link to comment Share on other sites More sharing options...
RichardRotterdam Posted May 8, 2008 Share Posted May 8, 2008 depends on what you call youre back button if it is an html button with that function as event it should work . if you are trying to control a browser button that wouldnt work at all Quote Link to comment Share on other sites More sharing options...
GameYin Posted May 8, 2008 Share Posted May 8, 2008 Javascript isn't set up to save users data. Quote Link to comment Share on other sites More sharing options...
sunilvadranapu Posted May 8, 2008 Author Share Posted May 8, 2008 thanks for your reply. my problem is, I have designed a form which takes data like name, contact number, e-mail etc from users. if users enter wrong e-mail and submit the form, it validates the form data and gives "back" link to correct wrongly entered data. Incorrect e-Mail address. Please go <a href="javascript:history.back();">back</a> and enter the e-Mail address correctly when i click the "back" link, all of the form data was gone. how can i make retain the form data when clicked the back link. data is retained when going through browser's back button. but not with javascript:history.back method any ides?? thanks again. Quote Link to comment Share on other sites More sharing options...
GameYin Posted May 8, 2008 Share Posted May 8, 2008 Try have the validation on the same page as the form, and set action to server self. That way, no "back" will be needed. Quote Link to comment Share on other sites More sharing options...
RichardRotterdam Posted May 8, 2008 Share Posted May 8, 2008 this is not really a javascript issue what you really need is serverside validation. when certain fields are empty or incorrect you should retrieve the posted data and show the form again. this is php related. you can validate your form using javascript however you should always use serverside validation and javascript to create a more user friendly experience. look up php form validation tutorials Quote Link to comment Share on other sites More sharing options...
GameYin Posted May 8, 2008 Share Posted May 8, 2008 Along with that, if user has Js disabled, that data will go (into database or whatever you doing with it) unvalidated. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.