Consider:
1. Fill in a form
2. Click submit
3. Hit the back button
Expected results:
I can click my button aagain.

Actual results:
The button is still disabled.

Maybe we can add some js that re-enables any disabled buttons in unload.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

greggles’s picture

In my testing on Firefox and Chrome latest on Ubuntu client, it seems that this only affects Firefox.

It also seems like doing something in unload or onbeforeunload can sometimes re-enable the button so quickly that it can be accidentally clicked AND it doesn't consistently re-enable it when the back button is clicked. So, I'm not sure if we can or should really do anything about this.

I'll leave this issue open, but I'm not working on it currently.

greggles’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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

mogwaay’s picture

Issue summary: View changes

Hi there,

I don't think this issue is fixed. With the hide_submit module enabled, default settings (ie, button disables) but with a reset timer of 30seconds, I still get the back button disabled on a Views page that uses an exposed filter in Firefox. The timer that would re-enable the button doesn't seem to be running as the button doesn't re-enable after 30+seconds (waited about 5mins now as I write this) on navigating back to the page.

I think this is caused by the 'bfcache' feature of Firefox 1.5+

https://developer.mozilla.org/en-US/docs/Using_Firefox_1.5_caching

A solution for this would be to add code to disable the bfcaching of the page as described on the page above. For example, perhaps by adding a "pageshow" event listener or using an "unload" event to prevent caching.

I'm investigating additional solutions to this for our site and will share a patch if I have something useful.

Cheers,
Chris.

mogwaay’s picture

Status: Closed (fixed) » Active
mogwaay’s picture

Here's a patch that uses the 'unload' method to reset the submit buttons.

I've done a bit of cross-browser testing on 2 types of forms we use on our site and had problems with Firefox back button (a simple view with an exposed filter and a simple email sign-up webform) with this fix, set to disable the button, not hide: and it seems to work well for both on all browsers tested (Chrome 35:Win7, Firefox 30:Win7, IE8:WinXP, IE11:Win7 & Safari 5:Win7).

Only issues I noticed was in Firefox 30, there is a very short flash of an 'enabled' submit button (~half a second) - I assume this is when the unload event occurs and just before it's shown the new page. I think this is acceptable and a definite improvement over leaving the user hanging with no way to submit the form again if they go back.

An alternative fix could be to use the pageshow event to re-enable the submit buttons as this is always called when reloading the page from cache, however I'm concerned with cross-browser implementation of that event and I'd be worried about odd use-cases where that event may be called when you want the button to be disabled - unload seems much easier to understand.

mogwaay’s picture

For a live example of the issue:

1. In Firefox 30, go here:

http://www.foe.co.uk/resource/press_releases/press_releases_7978

2. Change the exposed filter to 2006, click "Go"
3. Click on the back button
4. Observe that the "Go" button is still disabled
5. Wait 30seconds (the length of the timeout)
6. Observe that the "Go" button stays disabled (ie, no timeout seems to be running to reset it)

We may be deploying the patch above soon, so sorry if this may be fixed by then...

func0der’s picture

Patch fixing this for all forms.

Maybe this is a bit too harsh, but there is no property indicating forms having hide_submit enabled, so we have no choice.