IE not repopulating forms under Rails views - very odd


#1

It is common practice to implement semi-persistent state across page
views using hidden form fields since all major browsers repopulate the
form fields with the last value of each field (provided that the
browser hasn’t been closed). A longer explanation with samples is
here:
http://codinginparadise.org/weblog/2005/08/ajax-tutorial-saving-session-across.html

There’s a very simple example at the bottom of that page that I’ve
been able to recreate perfectly… until I try to get it to work in
Rails under Internet Explorer. A working example is available here:

http://www1.zvents.com/test.rhtml

View the page source and hit reload a couple times to see the purpose
of the page. It takes advantage of browsers repopulating form fields
to achieve semi-persistent storage.

If I take that EXACT same source and move it into a rails view
rendered without layout, we get the following:

http://www1.zvents.com/events/test

If you do a page source on each page, you’ll see that the source is
identical. But for some reason, the persistence does not work in IE!
Works fine in Firefox. I’ve tried this on Apache, lighttpd and
webrick using both an existing and a fresh rails code base and nothing
works. I’m completely out of ideas. Is there something about the way
that Rails handles requests (routes? rewriting?) that is messing up
IE’s ability to repopulate form values?

I’ve also noticed that this affects all my regular HTML forms as well
(again IE only).

Any thoughts or help would be appreciated.

Tyler


#2

This doesn’t help you with your exact problem, but I thought you might
find it useful.

This idea of maintaining short-term state in Rails is accomplished
“the Rails way” by using the Flash hash to pass data. See the API
docs: http://api.rubyonrails.com/classes/ActionController/Flash.html


#3

Kyle M. <kyle@…> writes:

This doesn’t help you with your exact problem, but I thought you might
find it useful.

This idea of maintaining short-term state in Rails is accomplished
“the Rails way” by using the Flash hash to pass data. See the API
docs: http://api.rubyonrails.com/classes/ActionController/Flash.html

Thanks for the suggestion, but this is a slightly different kind of
state.
Since browsers normally persist information in forms across page views,
you can
use this to maintain client-side state information even when the browser
leaves
a page in question and then returns to it (normally using the back
button).
This approach is necessary if your application uses AJAX and you want to
maintain state across page views.

Tyler