• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Design issue "DisableOnSubmit" should check if element should be disabled before re-enabling it

Chris D

XenForo developer
Staff member
I have a Disabler activated for a submit button so that a user confirmation is required before submitting a form (confirming agreement of a license agreement / terms and conditions).

When the "I agree..." checkbox is clicked, the submit button is activated. When the submit button is clicked, as expected, the submit button is disabled for X seconds. If before X seconds is up, you then uncheck the I agree checkbox (hence the submit button should be disabled), when the timer runs out it re-enables the submit button, despite the Disabler being in such a state that should keep the button disabled:



XenForo developer
Staff member
I'm going to say that this is mostly out of the scope of the default code. There will always be a challenge when multiple behaviors compete over a single attribute. I would imagine there are other situations like this.

That said, you can listen to EnableSubmitButtons on the containing form and trigger XFRecalculate which should handle it.

Chris D

XenForo developer
Staff member
That definitely sounded worth a try, but it didn't work.

$form.on('EnableSubmitButtons', function(e)
And I also modified XFRecalculate in xenforo.js thus for testing:
$form.bind('XFRecalculate', function() { console.log('XFRecalculate!'); setStatus(null, true); });
And everything seems to fire ok:

But still it doesn't re-disable the buttons based on the Disabler state.

I haven't gone further than that, mostly because I've worked around the issue by making the Download button an OverlayCloser and not caching the overlay, but thought it worth mentioning.