Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
For some reason, Chrome (I'm on 61.0.3163.100) auto fills the first line of the address in the coupon field.
Here's the html that's being output for me:
<input data-drupal-selector="edit-sidebar-coupon-redemption-form-code" type="text" id="edit-sidebar-coupon-redemption-form-code" name="sidebar[coupon_redemption][form][code]" value="" size="60" maxlength="128" class="form-text">
Comment | File | Size | Author |
---|---|---|---|
#5 | coupon_autofill.patch | 711 bytes | ryross |
|
Comments
Comment #2
joekersWe've got this issue too. Adding
autocomplete="off"
to the end of the<form>
element seems to fix it but I'm not happy with it - I'm keen to find a better solution.Comment #3
ryross CreditAttribution: ryross commentedI've done a little bit more testing. If we change the element name in
docroot/modules/contrib/commerce/modules/promotion/src/Element/CouponRedemptionForm.php
from
$element['code'] = [
'#type' => 'textfield',
'#title' => $element['#title'],
'#description' => $element['#description'],
'#access' => !$cardinality_reached,
];
to
$element['couponcode'] = [
'#type' => 'textfield',
'#title' => $element['#title'],
'#description' => $element['#description'],
'#access' => !$cardinality_reached,
];
then it doesn't autofill. It's triggered on 'code'. I can't seem to find why though. Here's a list of regex strings that Chrome uses:
https://cs.chromium.org/chromium/src/components/autofill/core/common/autofill_regex_constants.cc?gsn=kAddressLinesExtraRe&l=32
Comment #4
ryross CreditAttribution: ryross commentedI'm uploading a patch that sets autocomplete to 'new-password'.
Comment #5
ryross CreditAttribution: ryross commentedFixing the comment style
Comment #6
ryross CreditAttribution: ryross commentedHere's some background information on autofilling with Chrome: https://bugs.chromium.org/p/chromium/issues/detail?id=468153
Comment #7
bojanz CreditAttribution: bojanz at Centarro commentedHouston, we have a patch.
Comment #8
bojanz CreditAttribution: bojanz at Centarro commentedWe only use [], never array(). That's old syntax.
I'll fix this on commit.
Comment #10
bojanz CreditAttribution: bojanz at Centarro commentedThanks!