Wicket
  1. Wicket
  2. WICKET-5093

The event listener in Wicket.Ajax.ajax() should not return the value of attrs.ad (allowDefault)

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 6.6.0
    • Fix Version/s: 6.7.0
    • Component/s: wicket
    • Labels:
      None

      Description

      Currently the event listeners registered in Wicket.Ajax.ajax() return the value of attrs.ad as a result.
      This is wrong because this way the event propagation is effected.

      event.preventDefault != event.stopPropagation

      If the propagation has to be stopped then a before handler can do "Wicket.Event.stop(attrs.event)" where needed.

        Issue Links

          Activity

          Martin Grigorov created issue -
          Martin Grigorov made changes -
          Field Original Value New Value
          Status Open [ 1 ] Resolved [ 5 ]
          Fix Version/s 6.7.0 [ 12323964 ]
          Resolution Fixed [ 1 ]
          Hide
          Sven Meier added a comment -

          This change leads to doubled submits in the following scenario:

          • user enters something in a textfield
          • user clicks ajax button
          • "change" ajax event on textfield sends Ajax request
          • "click" ajax event on button is queued, no longer returning false
          • browser submits form via non-ajax
          • queued "click" ajax event is send via Ajax, resulting in second form submit
          Show
          Sven Meier added a comment - This change leads to doubled submits in the following scenario: user enters something in a textfield user clicks ajax button "change" ajax event on textfield sends Ajax request "click" ajax event on button is queued, no longer returning false browser submits form via non-ajax queued "click" ajax event is send via Ajax, resulting in second form submit
          Sven Meier made changes -
          Resolution Fixed [ 1 ]
          Status Resolved [ 5 ] Reopened [ 4 ]
          Hide
          Sven Meier added a comment -

          IMHO this change should be reverted and the issue be revisited in Wicket 7.x

          Show
          Sven Meier added a comment - IMHO this change should be reverted and the issue be revisited in Wicket 7.x
          Martin Grigorov made changes -
          Link This issue relates to WICKET-5178 [ WICKET-5178 ]
          Hide
          Martin Grigorov added a comment -

          You think that the solution suggested in WICKET-5178 is not good anymore ?

          Show
          Martin Grigorov added a comment - You think that the solution suggested in WICKET-5178 is not good anymore ?
          Hide
          Sven Meier added a comment -

          The important thing is that stopPropagation and preventDefault have to be called before queuing the ajax event in a channel.

          I don't think we can make this change for Wicket 1.5.x or 6.x without breaking applications - better roll back to previous solution.

          Show
          Sven Meier added a comment - The important thing is that stopPropagation and preventDefault have to be called before queuing the ajax event in a channel. I don't think we can make this change for Wicket 1.5.x or 6.x without breaking applications - better roll back to previous solution.
          Hide
          Martin Grigorov added a comment -

          But the new setting will do exactly what has been done in 6.6.0. The benefit is that it will be configurable.
          It was configurable in 6.6.0 too - allowDefault has been used for this. Now there will be two settings for the two separate functionalities.
          Please provide a quickstart in WICKET-5178.

          Show
          Martin Grigorov added a comment - But the new setting will do exactly what has been done in 6.6.0. The benefit is that it will be configurable. It was configurable in 6.6.0 too - allowDefault has been used for this. Now there will be two settings for the two separate functionalities. Please provide a quickstart in WICKET-5178 .
          Hide
          Sven Meier added a comment -

          I don't know where you're planning to handle the new stopPropagation setting. If it is handled at the same place as preventDefault, then it won't fix this issue.

          Show
          Sven Meier added a comment - I don't know where you're planning to handle the new stopPropagation setting. If it is handled at the same place as preventDefault, then it won't fix this issue.
          Hide
          Sven Meier added a comment -

          Quickstart for 6.x:

          Enter something in the textfield, then press enter. Observe two "submit" log entries.

          This issue can be triggered by clicking on the button too, but it requires exact timing.

          Show
          Sven Meier added a comment - Quickstart for 6.x: Enter something in the textfield, then press enter. Observe two "submit" log entries. This issue can be triggered by clicking on the button too, but it requires exact timing.
          Sven Meier made changes -
          Attachment WICKET-5093.zip [ 12582288 ]
          Hide
          Martin Grigorov added a comment -

          Sven,

          An improvement is pushed to master branch.
          Please try it and report in WICKET-5178. If it is OK then I'll back port it to 6.x.
          Your quickstart app seems to work as desired now.

          Show
          Martin Grigorov added a comment - Sven, An improvement is pushed to master branch. Please try it and report in WICKET-5178 . If it is OK then I'll back port it to 6.x. Your quickstart app seems to work as desired now.
          Martin Grigorov made changes -
          Status Reopened [ 4 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]

            People

            • Assignee:
              Martin Grigorov
              Reporter:
              Martin Grigorov
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development