Problem/Motivation
Ajax forms (e.g. product attributes in on the commerce add-to-cart form) do not work properly for anonymous users. After the form was submitted for the first time, every subsequent attempt of any other user to reuse the form fails.
Authenticated users are not affected by this problem. Authcache Form has a mechanism built-in capable of cloning the form cache entries required by Ajax forms for authenticated users (see #1946022: Problem with ajax forms for more details).
Proposed resolution
The simplest way to resolve this problem would be to also allow cloning of form cache entries for anonymous users. However this will likely increase the form cache table even further. Also this problem only affects Ajax-enabled forms and therefore this is only a problem for clients having JavaScript enabled. Therefore a better approach would be to try and tap into the Ajax framework and only clone form cache entries when necessary (e.g. only during the first form-related Ajax request). This has the benefit that no work is done unless the user triggers a callback.
Remaining tasks
- Implementation
- Tests
User interface changes
None.
API changes
None.
Comment | File | Size | Author |
---|---|---|---|
#1 | 2171129-ajax-not-working-for-anonymous-users.diff | 11.29 KB | znerol |
Comments
Comment #1
znerol CreditAttribution: znerol commentedSorry for the delay. This turned out to be a security issue in Drupal core. Version 7.27 is going to be published in this minutes, let's see whether tests pass for the corresponding authcache patch.
Note that Cache Object API will be required in an upcoming release, otherwise pages with ajax forms will not be cached for authenticated users.
Comment #4
znerol CreditAttribution: znerol commentedFixed.
Comment #6
RAWDESK CreditAttribution: RAWDESK commentedI am not running Authcache on my site, but having a similar symptom as described in this issue's title.
To make it clear, i've captured the scenario in this short video :
http://castabo.rawdesk.be/temp/uc-ajax-first-request-not-executed-for-an...
As can be seen, the first AJAX request to my pricing component returns without a (visible) result.
PS. The colour option has no price change defined.
If i execute this scenerio with a logged in user (any role will do), the first request is always successful.
Any idea what might cause this ?
Comment #7
znerol CreditAttribution: znerol commentedPlease try the issue tracker of the commerce package you are using (Drupal Commerce, Ubercart).
Thanks.
Comment #8
RAWDESK CreditAttribution: RAWDESK commentedThanks for the referal.
Posted the issue in this thread : https://www.drupal.org/node/1380772#comment-9307151