1. 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

Discussion in 'Resolved Bug Reports' started by Chris D, Sep 6, 2014.

  1. Chris D

    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:

  2. Mike

    Mike 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 likes this.
  3. Chris D

    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.

Share This Page