Closed (fixed)
Project:
Commerce Core
Version:
7.x-1.x-dev
Component:
Cart
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
23 Nov 2010 at 15:12 UTC
Updated:
21 Nov 2017 at 21:49 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
damien tournoud commentedHm. Feels that the javascript should rather reload its state automatically.
Comment #2
miklProblem is, “autocomplete” is not a valid attribute according to the HTML specs (it may be in HTML5, but not HTML4/XHTML). Quoting the Sitepoint HTML reference on the input element:
Comment #3
rszrama commentedAhh, I see the problem. On the demo site at http://demo.commerceguys.com/dc/catalog/wearables/looking-smiling-faces if I select X-Large and then refresh the page I get:
Drupal's #ajax system isn't setup to capture the browser reusing a previous default value without triggering some sort of JS event, so the form isn't resubmitted with the selected value to update fields on the page. Obviously server side we have no way of knowing this has happened, so we either need to 1) ensure the expected defaults are set (i.e. using autocomplete or JS) or 2) resubmit that form on reload.
I don't like either option, but I'm not sure we have a way around this... and using JS to reset the value here will not be degradable, although I'm a bit worried about general degradation anyways. ; )
By experience, though, I wonder if Sitepoint isn't outdated. I've used autocomplete fields successfully on other browsers just fine - for example, it's used in Credit Card data entry forms to ensure browsers don't cache CC numbers. I think it bears further investigation. fwiw, I didn't know about it being usable on a form element.
Comment #4
dpolant commentedI checked recently and this is still a problem.
Here's what I've found: setting autocomplete="off" on either the form or the select/input elements does solve the problem in FF and IE. However since autocomplete is part of HTML 5, the resulting html will not validate under Drupal 7's default XHTML doctype. So although the 1 line solution is tempting, it leads to invalid markup so I would't recommend it.
The javascript reset option may be the best way to go. The attached patch stores defaults in Drupal.settings and sets the input/select values on page load if it detects that the form is not being loaded from a previous submission (i.e. user clicked refresh or hit the url directly).
Comment #5
mikejoconnor commentedI've tested this on patch on the latest version of kickstart. It works as anticipated, changing the values back to their default value when you reload the page.
Marking RTBC
Comment #6
esoteric1 commentedDid not work for me. After installing that code, I can no longer make any selections. they always reload the default selections. Although I was using the 7.x-1.x installation.
Comment #7
esoteric1 commentedComment #9
rszrama commentedTagging for http://contribkanban.com/#/board/commerce/7.x-1.x.
Comment #10
joelpittetI think the HTML attribute would be the cleaner approach and it's good on HTML5 and most current browsers:
http://www.wufoo.com/html5/attributes/06-autocomplete.html
Comment #11
joelpittet@mikl time's have changed since 2012... any chance your thoughts on this have too?
Comment #12
vasike+1 for
autocomplete="off"As i remember there was a similar issue for "Payments selection" in the checkout :(.
Comment #13
rszrama commentedLooks like we waited this one out ... patch should do it, per das-peter.
Comment #14
rszrama commentedCommitted.
Comment #15
joelpittetSweet thanks @rszrama!