Why doesn't the browser offer suggestions for this text box?

I have basic text input for a login form and I would like the browser to remember the email addresses the user entered, but it doesn't work. I don't think I will need to add a complete autocomplete system to get this to work, as this is what the browser should do. I don't see anything special on the sites I've visited where this works.

If I'm looking for this issue, all the answers are about disabling autocomplete.

Here's my login form:

<form id="login-form">
  <fieldset>
    <input id="email" type="email" placeholder="Your email" required="" >
    <input id="password" type="password" placeholder="Pick a good password" required="" minlength="6">
    <button class="login">Register</button>
  </fieldset>
</form>

      

+3


source to share


2 answers


So the problem here is that I didn't have a "name" attribute on my input. It also seems that I need to have specific meanings for the name. "email" works and "login" works, but "user_email" and "foo" don't work.

Surprisingly, this started working as soon as I added "name =" email "to the input, so it seems that Chrome is saving the values, but not showing them.



This simple input is all you need for Chrome to autocomplete your email:

<input name="email">

      

+5


source


I don't believe you can force the autocomplete of a custom browser.

HTML5 has an autocomplete form attribute .

Here is the W3C spec for the autocomplete attribute .



However, even if you set this attribute to "on", HTML form autocompletion will depend on the client's browser settings and configuration.

While you can, as you said, turn off autocomplete, there is no way to force an authorized user to autocomplete a form if they configure their browser not to remember the form history.

For example, here's how to turn off autocomplete for Firefox: https://developer.mozilla.org/en-US/docs/Mozilla/How_to_Turn_Off_Form_Autocompletion

0


source







All Articles