Disabling Firefox Auto Complete in Rails Forms

Here's an annoying little thing that led me touser now clicks "submit," that old data is going to
posting this tip today: Firefox has anoverwrite the new data in those fields.
autocomplete feature that keeps any form fieldsThat's bad news when you're trying to maintain
you've edited on a page filled with the same datadata integrity.
if you refresh the page. This is great if you'reSo how do you fix it?
say, ordering plane tickets and need to refreshWell, there is the ability to add to html form
for some reason because everything you'veobjects this piece of code:autocomplete="off"
changed will still be there once the page reloads.This effectively tells Firefox to ignore the caching
But this feature became a problem for me todaythat it would normally do to set itself up to
while I was working on a project. The core of theautocomplete the field if a refresh occurs. To
project is that it is a rating system for a series ofachieve this same change in Rails, you must add
short data pieces that are randomly loaded eachthe Ruby version of that code to every form
time the page is loaded, with the ability to bothelement that you want Firefox to ignore.
edit the data and submit the rating simultaneously.So to make a text_field form helper have
Therefore, if you were to click refresh on theFirefox autocomplete turned off, you would use
page, a new random data piece would be loaded.code like this:
This is all well and good, but when you throw in"off" %>
the Firefox autocomplete system into the mix,To do the same thing for a collection_select
things get all messy.helper, you need to add the autocomplete option
What I found was that if a user was editing ato the html_options hash that is passed to the
data piece, then for whatever reason clickedhelper like this:
refresh, a new data piece would be randomly"off"} %>
loaded for the next page load, but the editingHopefully this little tip will help some people out
fields that had data that was modified in it frombecause I know it drove me crazy today as I
before the refresh will still have that same data inthought my app was all messed up but it turned
those fields. So you've loaded a new data piece,out to be the browser.
but the old edited data is still in the fields, so if the