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. it work 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. I have no idea how to implement it. Can anyone please help me on this?
Asked
Active
Viewed 85 times
0
-
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 Answers
0
Store all the fields in localStorage for the session, and then when the page is loaded, use JavaScript to load everything from localStorage.
Maddy
- 98
- 1
- 11
-
Cookies work. I would use localStorage because it save it for the session. – Maddy Feb 03 '17 at 11:35
-1
- save state when location changed
- use state when page loaded
ian park
- 122
- 1
- 8
-
-
-
or if you already use jQuery, check Persist jQuery plugin. It give you same functionality with 'key-value' format – ian park Feb 03 '17 at 11:57
-
2