[
https://issues.apache.org/jira/browse/WICKET-1650?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Igor Vaynberg closed WICKET-1650.
---------------------------------
Resolution: Duplicate
Assignee: Igor Vaynberg
> AjaxSubmitLink attached to inner form may call wrong form's onSubmit()
> ----------------------------------------------------------------------
>
> Key: WICKET-1650
> URL: https://issues.apache.org/jira/browse/WICKET-1650
> Project: Wicket
> Issue Type: Bug
> Affects Versions: 1.3.3
> Reporter: David Shepherdson
> Assignee: Igor Vaynberg
>
> Just upgrading from 1.3.0 to 1.3.3 and I've noticed this bug, which seems to
> have been introduced with the implementation of the 'official' nested forms
> behaviour in 1.3.1.
> I have a page with the following structure (simplified):
> <form wicket:id="outer">
> <ajaxSubmitLink wicket:id="innerSubmitLink" />
> <form wicket:id="inner">
> </form>
> </form>
> In other words, there's an outer form, which contains an inner form and an
> AjaxSubmitLink. The link is connected to the inner form (i.e. the inner form
> is passed into the link's constructor), but not contained within it; clicking
> the link should submit the inner form *only*. However, what actually happens
> is that the outer form's onSubmit() method is called.
> This seems to be because the constructor for AjaxSubmitLink doesn't pass its
> form argument to the AbstractSubmitLink constructor, and therefore when
> Form.onFormSubmitted() calls submittingComponent.getForm() to find out which
> form has actually been submitted, it doesn't get back the inner form, but
> instead uses getParent() and finds the outer form.
> This looks like it should be trivial to fix by making AjaxSubmitLink call the
> correct AbstractSubmitLink constructor, so instead of:
> public AjaxSubmitLink(String id, final Form form)
> {
> super(id);
> ...it does:
> public AjaxSubmitLink(String id, final Form form)
> {
> super(id, form);
> ...then the getForm() method will return the correct form -- the one passed
> in if it's not null, or otherwise the enclosing form.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.