user1746402
user1746402

Reputation: 51

Chrome Autofill not filling correct input

Bit confusing and could not find any related issues online. As can be seen in the screenshot, when using the Chrome Autofill it is filling up the wrong input, even though the input have different ids.

This is using knockout template but not sure if its related.

HTML code for Billing Address

<input data-bind="value: $data.editor.SearchHouseNumber, uniqueId: $data.editor.SearchHouseNumber, valueUpdate: ['blur', 'afterkeydown', 'onload'], css: $data.editor.labelClass" maxlength="100" name="customerSearchHouseNumber" placeholder="House no." size="24" type="text" value="" title="" id="fld2">

HTML code for Delivery Address

<input data-bind="value: $data.editor.SearchHouseNumber, uniqueId: $data.editor.SearchHouseNumber, valueUpdate: ['blur', 'afterkeydown', 'onload'], css: $data.editor.labelClass" maxlength="100" name="customerSearchHouseNumber" placeholder="House no." size="24" type="text" value="" title="" id="fld17">

Google Auto Complete Issue

Upvotes: 1

Views: 405

Answers (1)

nwalton
nwalton

Reputation: 2061

As far as I can tell, Chrome actually implements the full autocomplete spec here, which means you should be able to specify which type of data Chrome should use to fill in the fields. Therefore, you can add the following attributes to your inputs: autocomplete="billing street-address" and autocomplete="shipping street-address", and Chrome will likely be able to supply the correct values.

Note that street-address designation can take multiline values (as per spec), so you may prefer address-line1.

Example:

<input name="billing_address" id="fld2" autocomplete="billing street-address">

Upvotes: 1

Related Questions