Win a copy of Zero to AI - A non-technical, hype-free guide to prospering in the AI era this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

history.back() not retaining changed values in previous page after call

Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I have an issue with Back button.
I have page1.jsp and page2.jsp
page1 contains a simple textbox with default value 5 and a submit button.
Submit on page1 leads to page2.jsp which has two buttons 1.Back button
2. Popup button which opens a simple jsp with javascript method.

Now in a senario where
I change the value of the textbox to 20 and clicks on submit I will get page2.
Here if I click on back button without touching the popup window button I am able to retain the changed value 20 in previous page i.e, page1.
But if I open the popup window by clicking on popup button and after closing it if I click on back button I am going to page1 button the textbox value is getting reset to default value 5.

If I use showModalDialog() instead of to open the popup I am able to retain the values but I need to copy values from the popup window which is not possible through showModalDialog().

Can anyone suggest a way to retain the values in previous page on click of back button after call.

Thanks in advance.

Posts: 15385
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The browser is remembering the value and there is no way to tell it to remember it or not. If you want the browser to always remember it, you would have to basically remember the value in a check for it when the page loads.

We're all out of roofs. But we still have tiny ads:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic