0

I am using grails 2.4.2 version which uses HTML 5. I have some form element based on some condition. Such as District, Thana. When I select the district then I am hiding thana and when selecting thana then hiding district. This works fine.

But when I click the go back button of the browser then it shows both the field. I want to keep the form element condition as I expected when a user click the go back button of the browser. How can I implement it?

halfer
  • 19,824
  • 17
  • 99
  • 186
Sumon Bappi
  • 1,937
  • 8
  • 38
  • 82
  • Personally think this is probably not designed well. You could maybe provide jquery-ui-tabs and illeminate the need to go back/forward. None the less much easier than stated so far (caching etc) http://stackoverflow.com/questions/1489486/jquery-plugin-to-serialize-a-form-and-also-restore-populate-the-form using jquery to serialize form and take that along with you might be an option. If they click next surely you are capturing that so store it and provide own back buttons that regenerates it through grails rather than javascript caching. That's how I would go about it – V H Feb 03 '17 at 16:34

2 Answers2

0

Store all the fields in localStorage for the session, and then when the page is loaded, use JavaScript to load everything from localStorage.

Phoebe
  • 108
  • 1
  • 11
-1
  1. save state when location changed
  2. use state when page loaded
ian park
  • 122
  • 1
  • 8