If you enable ajax and show a form the HTML / JS code get's cached. If you now disable the Ajax setting the cache is still active. You will not get the new form.

To repro you just need to change the widget color if you disable the Ajax setting and the new color is not loaded

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

hass’s picture

Liam Morland’s picture

@hass, do you know where this is getting cached and how to trigger a clear?

hass’s picture

I guess in page cache. We can do a clear if this setting is changed in the form.

Liam Morland’s picture

Status: Active » Postponed (maintainer needs more info)

I'm not seeing this problem, but maybe I am not reproducing it properly. Can you provide steps to reproduce it?

hass’s picture

Status: Postponed (maintainer needs more info) » Active
  1. Enable core page cache with 1h or more.
  2. Assign the captcha to password reset form
  3. Enable ajax support in recaptcha
  4. Open the password reset form with a second web browser (anonymous user)
  5. Now it is getting loaded in white and cached in white.
  6. Switch to your first browser and turn of ajax and change the color of recaptcha to red
  7. Reload the form in second browser.
  8. You still get the white recaptcha and not the red one. The html code is still in the cache and cache has not jet expired.

That is quite easy to fix. I'm only not sure if we need to clear the full page cache or if we may only clear the cached forms.

hass’s picture

Status: Active » Needs review
FileSize
929 bytes

Haven't tested if this code, but this how this could be done. The only thing I'm not sure is where the page is cached. It could be cache_page or cache_form. We need to verify this and if we could provide the cache ID it would be a lot faster.

Liam Morland’s picture

I can't reproduce the problem, though I was not trying on a complete clean install, so that might be why. I did see the message "The CAPTCHA module will disable the caching of pages that contain a CAPTCHA element" on the Performance page when I went there to turn on the page cache. If statement is true, I don't see how the reCAPTCHA can be getting cached anyway.

hass’s picture

http://cgit.drupalcode.org/recaptcha/tree/recaptcha.module?h=7.x-1.x#n90

If ajax is enabled the caching is re-enabled and disabled caching of captcha module is therefore overridden.

hass’s picture

Have you now understood the code of the module your are maintaining?

  • Liam Morland committed fcd865d on 7.x-1.x
    Issue #2500335 by hass: Clear cache when Ajax API is switched off.
    
Liam Morland’s picture

Status: Needs review » Fixed

Thanks.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.