# IE not repopulating forms under Rails views - very odd

**URL:** <https://www.ruby-forum.com/t/ie-not-repopulating-forms-under-rails-views-very-odd/47512>\
**Category:** Rails\
**Created:** [November 12, 2005, 12:49pm UTC](https://www.ruby-forum.com/t/ie-not-repopulating-forms-under-rails-views-very-odd/47512 "2005-11-12T12:49:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tyler.kovacs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/7ea924/32.png) [@tyler.kovacs](https://www.ruby-forum.com/u/tyler.kovacs)\
**Post date:** [November 12, 2005, 12:49pm UTC](https://www.ruby-forum.com/t/ie-not-repopulating-forms-under-rails-views-very-odd/47512/1 "2005-11-12T12:49:17Z")

</div>

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](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](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](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

---

<div class="post-metadata">

**Author:** ![tyler.kovacs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/7ea924/32.png) [@tyler.kovacs](https://www.ruby-forum.com/u/tyler.kovacs)\
**Post date:** [November 12, 2005, 12:49pm UTC](https://www.ruby-forum.com/t/ie-not-repopulating-forms-under-rails-views-very-odd/47512/2 "2005-11-12T12:49:17Z")

</div>

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: [Peak Obsession](http://api.rubyonrails.com/classes/ActionController/Flash.html)

---

<div class="post-metadata">

**Author:** ![tyler.kovacs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/7ea924/32.png) [@tyler.kovacs](https://www.ruby-forum.com/u/tyler.kovacs)\
**Post date:** [November 12, 2005, 12:49pm UTC](https://www.ruby-forum.com/t/ie-not-repopulating-forms-under-rails-views-very-odd/47512/3 "2005-11-12T12:49:20Z")

</div>

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: [Peak Obsession](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
