Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-5594

AjaxButton #onSubmit() #onError() intricacies

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Trivial
    • Resolution: Fixed
    • 7.0.0-M1
    • 7.0.0-M2
    • wicket
    • None

    Description

      Overriding AjaxButton's hook #onSubmit() is prone to possible programming errors:

      • with JavaScript enabled, #onSubmit() will not be called, leaving the developer without clue that the wrong method was overwritten
      • with JavaScript disabled, #onSubmit(ART, Form) will not be called - furthermore if the markup includes type="submit" or no type attribute, #onSubmit() will be called instead.

      #onError() and #onError(ART, Form) have identical intricacies.

      To make things consistent I propose the following change for Wicket 7.x:

      • declare #onSubmit() and #onError() final on AjaxButton
      • in #onComponentTag() make sure the <button>-Tag has type="button", so the browser does not submit the form when JavaScript is disabled. For fallack support we have AjaxFallbackButton already.

      Any objections or better ideas?

      Attachments

        Issue Links

          Activity

            People

              svenmeier Sven Meier
              svenmeier Sven Meier
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: