I've implemented a custom multistep AJAX form like:

STEP #1 Question 1: A or B (radiobutton Ajaxified) -> AjaxCallback: step + 1

STEP #2 Question 2: C or D (radiobutton Ajaxified) -> AjaxCallback: step + 1;

STEP #3 Question 2: E or F (radiobutton Ajaxified) -> redirect to other page (ajax command)

Everything works as expected but after being redirected to the new page if I click the browser back button in firefox the form shows the first step with the option [A] selected of the first step. This does not happen in Chrome.

I'm running Firefox 54.0.1

Does it make sense to anyone? How could I fix it?

Thanks in advance!

2 Answers 2


It seems chrome makes a refresh of the page and firefox a cache. Seeing this question the reasons are answered here

You can try disabling caches using http headers: https://stackoverflow.com/questions/13640109/how-to-prevent-browser-cache-for-php-site


On Drupal 8, I was having an issue with Firefox that was caching the value of a field, selected by the user before refreshing the page.

It was basically overriding the #default_value of the field.

My solution was to Turn Off Form Autocompletion (https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion).

You can do it at the level on the input if that's an , but since it was a in my case I had to do it at the form level :

$form['#attributes']['autocomplete'] = 'off';
  • This also works in Drupal 7 and on individual form elements. Commented Jan 17, 2019 at 5:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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