[ https://issues.apache.org/jira/browse/WICKET-1397?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
David Shepherdson closed WICKET-1397. ------------------------------------- Thanks -- I can confirm that this is fixed in 1.3.3. > AjaxSubmitLink doesn't always find enclosing form properly > ---------------------------------------------------------- > > Key: WICKET-1397 > URL: https://issues.apache.org/jira/browse/WICKET-1397 > Project: Wicket > Issue Type: Bug > Affects Versions: 1.3.0-final > Reporter: David Shepherdson > Assignee: Gerolf Seitz > Priority: Minor > Fix For: 1.3.2 > > > 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. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.