Wicket
  1. Wicket
  2. WICKET-1397

AjaxSubmitLink doesn't always find enclosing form properly

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.3.0-final
    • Fix Version/s: 1.3.2
    • Component/s: None
    • Labels:
      None

      Description

      If the AjaxSubmitLink constructor that doesn't take in a form is called, it calls the constructor that does take in a form with null for the form. This seems correct, and it passes the form argument into the constructor of the AjaxFormSubmitBehavior as also seems correct. AjaxFormSubmitBehavior has a private getForm() method that, if the form is null, sensibly searches through the component hierarchy to find a form that contains the component. This is also good.

      The bit that seems wrong is that the overridden onSubmit(AjaxRequestTarget) and onError(AjaxRequestTarget) methods in AjaxSubmitLink's version of AjaxFormSubmitBehavior call AjaxSubmitLink's onSubmit and onError with the form argument that was originally passed into the constructor. This means that if you originally called the one-argument constructor for AjaxSubmitLink, the onSubmit and onError methods will be called with a null form, rather than the actual form that was submitted.

      As far as I can see, an easy fix for this would be to make getForm() in AjaxFormSubmitBehavior protected rather than private, and then to call getForm() in the overridden onSubmit and onError in AjaxSubmitLink's version of AjaxFormSubmitBehavior. That way the AjaxSubmitLink's onSubmit and onError would always be called with the actual form that was submitted.

        Activity

        David Shepherdson created issue -
        Hide
        Gerolf Seitz added a comment -

        thanks

        Show
        Gerolf Seitz added a comment - thanks
        Gerolf Seitz made changes -
        Field Original Value New Value
        Assignee Gerolf Seitz [ seitz ]
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 1.3.2 [ 12312942 ]
        Resolution Fixed [ 1 ]
        Hide
        David Shepherdson added a comment -

        Thanks – I can confirm that this is fixed in 1.3.3.

        Show
        David Shepherdson added a comment - Thanks – I can confirm that this is fixed in 1.3.3.
        David Shepherdson made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Igor Vaynberg made changes -
        Assignee Gerolf Seitz [ seitz ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        2d 13h 39m 1 Gerolf Seitz 08/Mar/08 01:00
        Resolved Resolved Closed Closed
        75d 10h 52m 1 David Shepherdson 22/May/08 12:52

          People

          • Assignee:
            Unassigned
            Reporter:
            David Shepherdson
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development