I am implementing in Ruby on Rails, and I have a view, with all sort of elements, like checkboxes, dropdownlist and so on. So if I go to the next view, and then I click on back in my browser, everything is like I filled in, like I checked the checkboxes and things like that. This is how I want, it, but now I want to implement a button, just to go back to that view, i have for this button :
redirect_to request.referrer
or i tried as well
redirect_to the previous view
but when I do this, I go back, but everything is set to default again. Checkboxes aren’t checked… Does someone know what to do, to get the view back like I filled it in, like I get when i click on Back on my browser?
The quick and dirty way would be to do it in javascript I guess:
However there might be problems with some or older browsers, since these values are remembered by the browser.
If you want to do it the right way, you would have to save your data in a session first, and then populate the fields with the session data.