# Text\_field\_with\_auto\_complete Vs a browsers autocomplete fun

**URL:** <https://www.ruby-forum.com/t/text-field-with-auto-complete-vs-a-browsers-autocomplete-fun/104627>\
**Category:** Rails\
**Created:** [May 20, 2007, 10:40pm UTC](https://www.ruby-forum.com/t/text-field-with-auto-complete-vs-a-browsers-autocomplete-fun/104627 "2007-05-20T22:40:21Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![stubbsuk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e56c9b/32.png) [@stubbsuk](https://www.ruby-forum.com/u/stubbsuk)\
**Post date:** [May 20, 2007, 10:40pm UTC](https://www.ruby-forum.com/t/text-field-with-auto-complete-vs-a-browsers-autocomplete-fun/104627/1 "2007-05-20T22:40:21Z")

</div>

In the demo at [http://demo.script.aculo.us/ajax/autocompleter\_customized](http://demo.script.aculo.us/ajax/autocompleter_customized)  
the input firld generated by text\_field\_with\_auto\_complete has an  
autocomplete attribute set to off, which stops the browser using it’s  
own auto complete function, but when I use it, that attribute is now  
there and Firefox’s version gets in the way.

I’ve tried adding :autocomplete =\> “off” as an option, but that didn’t  
work, what am I missing?

Cheers

-S

---

<div class="post-metadata">

**Author:** ![stubbsuk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e56c9b/32.png) [@stubbsuk](https://www.ruby-forum.com/u/stubbsuk)\
**Post date:** [May 21, 2007, 2:36am UTC](https://www.ruby-forum.com/t/text-field-with-auto-complete-vs-a-browsers-autocomplete-fun/104627/2 "2007-05-21T02:36:50Z")

</div>

I would expect it to automatically add that attribute. However if  
it’s not working then check out the defintion of the  
text\_field\_with\_auto\_complete method:

text\_field\_with\_auto\_complete(object, method, tag\_options = {},  
completion\_options = {})

Note that the autocomplete=“off” would belong in the tag\_options,  
which means you would have explicitly wrap it in curly braces to  
separate it from the completion\_options. Or, the opposite problem  
would be that you are clobbering the autocomplete attribute that is  
included by default which would be solved by putting a blank  
tag\_options in. What does your code look like?

On May 20, 2:39 pm, Stuart Grimshaw [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![stubbsuk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e56c9b/32.png) [@stubbsuk](https://www.ruby-forum.com/u/stubbsuk)\
**Post date:** [May 21, 2007, 7:42pm UTC](https://www.ruby-forum.com/t/text-field-with-auto-complete-vs-a-browsers-autocomplete-fun/104627/3 "2007-05-21T19:42:41Z")

</div>

On May 21, 1:35 am, dasil003 [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> would be that you are clobbering the autocomplete attribute that is  
> included by default which would be solved by putting a blank  
> tag\_options in. What does your code look like?

\<%= text\_field\_with\_auto\_complete :vendor, :postcodes,  
{ “autocomplete” =\> ‘off’ }, :skip\_style =\> true %\>

That is the field in question …

---

<div class="post-metadata">

**Author:** ![stubbsuk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e56c9b/32.png) [@stubbsuk](https://www.ruby-forum.com/u/stubbsuk)\
**Post date:** [May 21, 2007, 9:44pm UTC](https://www.ruby-forum.com/t/text-field-with-auto-complete-vs-a-browsers-autocomplete-fun/104627/4 "2007-05-21T21:44:59Z")

</div>

I pasted that into one of my views and change the model/method name  
and it worked. autocomplete=“off” was the first attribute of the  
input tag.

Are you on Rails 1.2.3 and do you have any plugins that much around  
with the internals?

On May 21, 11:42 am, Stuart Grimshaw [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![stubbsuk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e56c9b/32.png) [@stubbsuk](https://www.ruby-forum.com/u/stubbsuk)\
**Post date:** [May 30, 2007, 12:57am UTC](https://www.ruby-forum.com/t/text-field-with-auto-complete-vs-a-browsers-autocomplete-fun/104627/5 "2007-05-30T00:57:58Z")

</div>

Take the plugins out and see if it works. If not, start a new  
application and just copy the view code in and see if it works.

On May 29, 11:59 am, Stuart Grimshaw [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![stubbsuk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e56c9b/32.png) [@stubbsuk](https://www.ruby-forum.com/u/stubbsuk)\
**Post date:** [May 29, 2007, 8:01pm UTC](https://www.ruby-forum.com/t/text-field-with-auto-complete-vs-a-browsers-autocomplete-fun/104627/6 "2007-05-29T20:01:16Z")

</div>

On May 21, 8:43 pm, dasil003 [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I pasted that into one of my views and change the model/method name  
> and it worked. autocomplete=“off” was the first attribute of the  
> input tag.
> 
> Are you on Rails 1.2.3 and do you have any plugins that much around  
> with the internals?

stuart@shearer:~$ ruby -v  
ruby 1.8.6 (2007-03-13 patchlevel 0) [i486-linux]  
stuart@shearer:~$ rails -v  
Rails 1.2.3

and vendor/plugins contins:

foreign\_key\_migrations/ redhillonrails\_core/  
simple\_http\_auth/ transactional\_migrations/

---

<div class="post-metadata">

**Author:** ![stubbsuk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e56c9b/32.png) [@stubbsuk](https://www.ruby-forum.com/u/stubbsuk)\
**Post date:** [June 4, 2007, 9:14pm UTC](https://www.ruby-forum.com/t/text-field-with-auto-complete-vs-a-browsers-autocomplete-fun/104627/7 "2007-06-04T21:14:07Z")

</div>

On May 29, 11:56 pm, dasil003 [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Take the plugins out and see if it works. If not, start a new  
> application and just copy the view code in and see if it works.

The problem is being caused by Sxipper ([http://www.sxipper.com](http://www.sxipper.com)), when  
it is enabled, the autocomplete attribute of the field gets removed,  
however with the plugin switched off, the autocomplete attribute  
remains in place.

I’ll raise a bug with the Sxipper team, as I don’t see how this could  
(or should?) be handled by the Ruby devs.

Thanks for your help this far Dasil003

-S
