You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Pedro Santos (JIRA)" <ji...@apache.org> on 2010/09/06 20:59:34 UTC

[jira] Commented: (WICKET-1743) WicketTester fires onSubmit for first form button prior to firing requested ajax event

    [ https://issues.apache.org/jira/browse/WICKET-1743?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12906564#action_12906564 ] 

Pedro Santos commented on WICKET-1743:
--------------------------------------

The submit calls sequence can't be considered as an bug, only the one described by you looks more natural than the current one.
About the button's onSubmit unexpected call, it is an bug. Taking a look at the BaseWicketTester, I noticed that submitAjaxFormSubmitBehavior method is adding the Button component input name as an request parameter. This is enough to the form component consider that this button was clicked, and that it's onSubmit method need to be invoked. See: Form#findSubmittingButton.

Currently there is an test avoiding Button components from have it's input name on request parameters.

At: BaseWicketTester#submitAjaxFormSubmitBehavior
there is the test: !formComponent.getClass().isAssignableFrom(Button.class)

But this test don't make sense since the formComponent will almost always be an Button subclass.
Change the test to: "!(formComponent instanceof Button)" fix Nick's test case and breaks 3 others.
I will take a better look at those broken test cases and see if there is something wrong with them...

> WicketTester fires onSubmit for first form button prior to firing requested ajax event
> --------------------------------------------------------------------------------------
>
>                 Key: WICKET-1743
>                 URL: https://issues.apache.org/jira/browse/WICKET-1743
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.4
>            Reporter: Nick Johnson
>         Attachments: wicket1743.jar
>
>
> In a form that contains a submit button and a text field, when performing tester.executeAjaxEvent("form:text", "onkeyup") on a field with an AjaxFormSubmitBehavior, first the submit button's onSubmit method is executed, and then the AjaxEvent is executed.  In the event that there are multiple submit buttons, it is the first one that gets fired.
> The expected behaviour is that the AjaxFormSubmitBehavior's onSubmit method is called followed by the form's onSubmit method, and the first submit button's onSubmit method is not called.
> I'll attach a simple test case.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.