4

Since a couple of days Magento and Onestepcheckout are behaving in a way which yields unwanted results.

We have a separate housenumber field in the checkout which was working great until last week. Since then we are getting orders with the streetname filled in in the separate housenumber field. So we get:

John Doe
Street Street
Zipcode City

Instead of

John Doe
Street 13
Zipcode City

I think it has to do with the autofill option of a browser. Chrome maybee? I think there must have been an update or something which is responsible for these results. The question is how can I fix this?

Solutions by priority:

  1. Fix it in a way so browsers understand there is a seperate housenumber field and it doesn't replicate the street field. Is this possible? If yes, how can I implement it in Magento since naming of formfields are based on conventions.
  2. Disable autofill for the housenumber field. I looked this up, there are lots of questions about it, but I couldn't find a recent solution which works for all major browsers.
  3. Disable form filling for the whole form (least/not desirable solution)
2

This is because Magento allows multiple lines for the street address and your house number field is actually something like "street[2]" which seems to be recognized as street. You can add autocomplete="off" to the input, but it seems like recent browsers tend to ignore this value. According to https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion the trick is to use an invalid value such as autocomplete="nope"

  • I just tried that, but it disables the autofill for the complete form. I tested it on Chrome (Version48.0.2564.103 m). It's the same result like I tried earlier today autocomplete="disabled". Better would be to disable it for only that specific field. – Akif Feb 9 '16 at 20:14
  • To be sure: You added it to this input element only? – Fabian Schmengler Feb 9 '16 at 20:17
  • Yup, of course:) – Akif Feb 9 '16 at 20:18
  • Same result here. Using the autocomplete attribute on a form input field disables autocomplete for the entire form. – BrianVPS Feb 16 '16 at 17:54
  • Any ideas for the next step? – Akif Feb 18 '16 at 21:35
1

Maybe this link could be of some help?

link

  • 1
    I may be mistaken but this seems to be completely made up by Google and isn't actually part of the spec. I tried this for the street lines and putting autocomplete="address-line2" for the second address line completely disables autofill in Chrome. According to W3Schools, the only valid values for autocomplete are "on" and "off" w3schools.com/tags/att_input_autocomplete.asp – BrianVPS Feb 16 '16 at 17:52
0

The suggestions of using the autocomplete attribute is correct, except that I found you had to enter to attributes for all fields on the checkout page!

If you specify the autocomplete="address-line2" nothing will work because it needs autocomplete="given-name" for the firstname field.

The following three files need copying from the default theme and updating:

app/design/frontend/rwd/your-theme/template/persistent/checkout/onepage/billing.phtml

app/design/frontend/rwd/your-theme/template/checkout/onepage/shipping.phtml

This file needs copying from the base theme and updating:

app/design/frontend/rwd/your-theme/template/customer/widget/name.phtml

  • 1
    Does this solve the problem? If yes, in whcih way? I don't understand what the actual solution is. What needs to be edited in the form? – Akif Feb 7 '17 at 10:39
0

You can use this function in java script to set autocomplete 'off' your form

yourFormName.setAttribute('autocomplete', 'off')

this worked for me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.