# How do I stop a browser prompting with past options

**URL:** <https://www.ruby-forum.com/t/how-do-i-stop-a-browser-prompting-with-past-options/172994>\
**Category:** Rails\
**Created:** [July 30, 2009, 10:33pm UTC](https://www.ruby-forum.com/t/how-do-i-stop-a-browser-prompting-with-past-options/172994 "2009-07-30T22:33:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![captaffy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f04885/32.png) [@captaffy](https://www.ruby-forum.com/u/captaffy)\
**Post date:** [July 30, 2009, 10:33pm UTC](https://www.ruby-forum.com/t/how-do-i-stop-a-browser-prompting-with-past-options/172994/1 "2009-07-30T22:33:16Z")

</div>

Browsers try to be helpful and remember that when you’ve filled in an  
input field named “email” before it’s been with  
“removed\_email\_address@domain.invalid” and they’ll suggest that entry again. If  
you’ve used many different values for a named field, then they’ll  
provide a drop down list of all the options you’ve ever used.

Mostly very useful, but not always. In my case I don’t want a long list  
of previous options to pop up in a field because it’s annoying the  
client. Also onchange behaves differently if you enter stuff into a  
field via the keyboard compared to selecting from previously entered  
values. In FF3 onChange isn’t triggered if you select from previous  
values, but it is if you key the data in.

I’ve found a workaround, which is to give fields unique names, either by  
packing the input field name with some random chars, or something else  
that’s unique, like the id of an order. But that is messy, horribly  
messy. There must be an easy way to do this. Maybe some param you can  
set on an input field, or some javascript trick.

Anyone have any ideas?

Thanks

John S.

---

<div class="post-metadata">

**Author:** ![captaffy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f04885/32.png) [@captaffy](https://www.ruby-forum.com/u/captaffy)\
**Post date:** [July 30, 2009, 10:45pm UTC](https://www.ruby-forum.com/t/how-do-i-stop-a-browser-prompting-with-past-options/172994/2 "2009-07-30T22:45:23Z")

</div>

On Jul 30, 2009, at 4:33 PM, John S. wrote:

> field via the keyboard compared to selecting from previously entered  
> Anyone have any ideas?
> 
> Thanks
> 
> John S.

Try adding :autocomplete =\> ‘off’ as in:

\<%= form.text\_field :email, :autocomplete =\> ‘off’ %\>

and see if that doesn’t do what you want.

-Rob

Rob B. [http://agileconsultingllc.com](http://agileconsultingllc.com)  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![captaffy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f04885/32.png) [@captaffy](https://www.ruby-forum.com/u/captaffy)\
**Post date:** [July 30, 2009, 10:48pm UTC](https://www.ruby-forum.com/t/how-do-i-stop-a-browser-prompting-with-past-options/172994/3 "2009-07-30T22:48:53Z")

</div>

Hi John,

> I’ve found a workaround, which is to give fields unique names, either by  
> packing the input field name with some random chars, or something else  
> that’s unique, like the id of an order. But that is messy, horribly  
> messy. There must be an easy way to do this. Maybe some param you can  
> set on an input field, or some javascript trick.

You’re looking for the :autocomplete option. As in…

\<%= text\_field\_tag ‘first\_name’, nil, :autocomplete =\> “off” %\>

HTH,  
Bill

---

<div class="post-metadata">

**Author:** ![captaffy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f04885/32.png) [@captaffy](https://www.ruby-forum.com/u/captaffy)\
**Post date:** [July 31, 2009, 11:06am UTC](https://www.ruby-forum.com/t/how-do-i-stop-a-browser-prompting-with-past-options/172994/4 "2009-07-31T11:06:21Z")

</div>

Bill & rob

:autocomplete =\> “off” %\>

I guessed that there had to be a simple way, though of course it’s  
almost entirely undocumented. I looked it up and, wonder of wonders,  
it’s one of the few good ideas Microsoft have brought to web  
programming, though it doesn’t make up for IE6.

It appears that autocomplete=“off” isnt’ part of the web standards  
though most browsers except Opera will support it. Maybe it’ll make it  
into HTML 5 or 6.

Thanks for the quick replies

John S.
