Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Turning off auto-complete for text fields in Firefox

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?

like image 611
inglesp Avatar asked Apr 13 '09 16:04

inglesp


People also ask

How do I turn off autocomplete in text field?

Add autocomplete="off" onto <form> element; Add hidden <input> with autocomplete="false" as a first children element of the form.

How do I turn off predictive text in Firefox?

Uncheck the box next to "Remember search and form history." After you uncheck this box, Autocomplete will be disabled in Firefox.


2 Answers

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

<%= f.text_field :fieldname %> 

put

<%= f.text_field :fieldname, :autocomplete => :off %> 
like image 140
inglesp Avatar answered Sep 18 '22 01:09

inglesp


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 %> 
like image 43
Jeff Steil Avatar answered Sep 22 '22 01:09

Jeff Steil