views:

1104

answers:

3

Am supposed to be learning French at the moment, but rather than learning any vocab, I've been mucking around with a rails app that tests vocab - so it displays a word, and I have to type its translation.

Unfortunately, Firefox remembers everything I've already type there, so which diminishes its usefulness somewhat.

Is it possible, through the options for form_for or otherwise, to turn this normally useful behaviour off?

+4  A: 

Add autocomplete="off" as an attibute on your form tag:

<form action="..." method="..." autocomplete="off" >
</form>
Erv Walter
this is what the raw HTML would look like, but it would be better to do it through rails itself...
inglesp
+6  A: 

So it turns out it's pretty simple. Rather than

<%= f.text_field :fieldname %>

put

<%= f.text_field :fieldname, :autocomplete => :off %>
inglesp
A: 

You can also turn off autocomplete at the form level by using the :autocomplete attribute in the :html collection, which will generate the HTML that Erv referenced. The syntax is

<% form_for :form_name, @form_name, :html => {:autocomplete => "off"} do |f|%>
...
<% end %>
Jeff Steil