4

I have 3 input boxes on a form.

Google Chrome offers autocomplete on them, so if you click on any of them, or start typing, you will see Chrome list of options, but as you move up and down among those autocomplete options, the 3 input boxes will get populated with the values, instead of the current textbox

http://jsfiddle.net/q3h2ydw1/1/

<form action="/" id="form1" method="post">

    <input id="email_one" x-autocompletetype="email" />
    <input id="email_two" x-autocompletetype="email" />
    <input id="email_three" x-autocompletetype="email" />

</form>

The goal is getting Chrome's autocomplete to show the emails on the current input, and not the 3 of them.

UPDATE

I tried it in a fresh computer. I didn't use any autocomplete tag, just raw input boxes:

<form action="/" id="form1" method="post">

    <input id="four" />
    <input id="five" />
    <input id="six" />

    <input type="submit" value="go" />

</form>

http://jsfiddle.net/q3h2ydw1/7/

After every submit, whatever you enter there gets stored, so you have autocomplete on following trips. Also, the autocomplete is scoped to the current textbox.

I think the issue I was experiencing initially was more than just auto complete, maybe auto-fill. While I was browsing through the options on one of the input boxes, all the other textboxes were getting filled as well. The solution is just giving the input-boxes a fresh new ID, like the last fiddle, initially the auto-complete history for that input will be lost, but with following form-post trips, a new autocomplete history will be created for them.

Agustin Garzon
  • 317
  • 2
  • 15
  • see if this helps.put a type="email" on the inputs and add a placeholder, autocompletettype takes a hint from the placeholder or label, adding a placeholder might help you – Billy Nov 10 '14 at 18:31
  • @Billy noop. http://jsfiddle.net/q3h2ydw1/2/ – Agustin Garzon Nov 10 '14 at 19:35
  • I've just loaded your 2nd fiddle on my localhost and run it in chrome and it only came up with the emails previously put into that box, ie. john@doe.com in the first box and then submitted then started with any other name and it worked like you wanted. on when i start entering jo.... it autocompletes. – Billy Nov 10 '14 at 20:32

1 Answers1

0

According to this answer, https://stackoverflow.com/a/30976223/7328169, if you give autocomplete semantic meaning, chrome will respect your choice.

Setting autocomplete="new-email" fixes this bug.

Here is a fork of your fiddle: http://jsfiddle.net/2edrgaou/

William Herrmann
  • 343
  • 2
  • 10