53

I am making a signup form for my website. It contains various standard form fields. Such as: name, address, phone number, user name, password, etc.

When I double-click on a field (in Chrome 16), so I can auto-fill my address, I get this message:

This webpage has disabled automatic filling for this form.

I didn't disable it, so how do I enable it? I tried adding autocomplete="on" to the <form> tag, and to (some of) the <input> tags, and that didn't help.

Do I need to add autocomplete="on" to every field? Also, how does the browser know what field is what? Do I need to name the fields something special?

Another question: Is there some kind of onautocomplete event that gets triggered when a form is auto-filled? On my form, when you enter a zip code, it looks in our database (via AJAX) and then gets the state and city (city and state are dropdowns, because zip codes can be for more than one city), and fills them in for you. I was hoping I could have that run after the form was auto-filled.

P.S. I'm using the jQuery form validation plugin, if that matters.

gen_Eric
  • 223,194
  • 41
  • 299
  • 337
  • add autocomplete="on" to the
    tag, that's it. Now erase your history for the last hour or so and refresh your page. Hopefully that might help. Regards
    – nIcE cOw Jan 03 '12 at 17:21
  • If you have one oracle account, login to the site, then click on Account next to your name, that page has autocomplete off, that you can see by watching its source code. Regards – nIcE cOw Jan 03 '12 at 17:23
  • @GagandeepBali: Tried that, didn't help =( I added `autocomplete="on"` to the `
    `, opened the page in Chrome's Incognito mode, and when I tried to autocomplete the address field, I got the error in the question.
    – gen_Eric Jan 03 '12 at 17:24
  • @GagandeepBali: "Oracle account"? What are you talking about? "that page has autocomplete off, that you can see by watching its source code" This is *my page*, and I'm trying to turn autocomplete *on*. – gen_Eric Jan 03 '12 at 17:24
  • 1
    had you disabled your chromes autofill options, so check them too , by going to options, personal stuff, autofill. Hopefully (Enable Autofill to fill out web forms in a single click) is checked. Regards – nIcE cOw Jan 03 '12 at 17:27
  • @GagandeepBali: I checked, Chrome's autofill is definitely on. I just tested it by trying to signup for an account on another webpage. It's something on my page that's disabling it. – gen_Eric Jan 03 '12 at 17:31

2 Answers2

73

The problem was that the form tag didn't have method="POST" on it.

After Googling the message, I found a bug report, and one of the comments mentioned method="POST".

I added method="POST", and voila! Auto-fill works.

In some cases you may also need to add an action if the form doesn't have one. action="javascript:void(0)" works.

Note: Auto-fill seems to trigger the onchange event.

Note 2: As for how the browser knows what field is what, see this question: How to trigger Autofill in Google Chrome?

Community
  • 1
  • 1
gen_Eric
  • 223,194
  • 41
  • 299
  • 337
3

The option to turn off autcomplete is normally located in the form tag, see the Developer page from Mozilla here. This should mean that normally removing that attribute should enable it again on a webpage.

Concerning the second part with the AJAX request, I don't think there's a listener for that, but you could add a function that checks the value of the field each x seconds for example, and if it changed you can perform your lookup.

  • I want to turn autocomplete *on*, not off. – gen_Eric Jan 03 '12 at 16:17
  • I made it a bit more clear. Meant to say that if you can turn it off by adding that attribute, you should be able to enable it by removing the attribute. – canihavesomecoffee Jan 03 '12 at 16:18
  • Removing the `autocomplete` attribute (or setting `autocomplete="on"`) hasn't enabled it. I still get the `This webpage has disabled automatic filling for this form.` message in Chrome. – gen_Eric Jan 03 '12 at 16:19
  • Is this a .NET site (asking because of the message)? I think there's some JavaScript they use as a backup to prevent autocomplete happening. – Tom Jan 03 '12 at 17:19
  • @Tom: Nope, it's PHP. And that message is from the browser (Chrome 16). – gen_Eric Jan 03 '12 at 17:23