[ https://issues.apache.org/jira/browse/WICKET-5821?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14292346#comment-14292346 ]
Carl-Eric Menzel commented on WICKET-5821: ------------------------------------------ This is well-defined behavior. The order of submit methods is: 1. submitting button: onSubmit 2. form itself: onSubmit 3. submitting button: onAfterSubmit Anything that needs to happen after the form's onSubmit can be done in onAfterSubmit. > Wicket calls AjaxButton#onSubmit() before Form#onSubmit() > --------------------------------------------------------- > > Key: WICKET-5821 > URL: https://issues.apache.org/jira/browse/WICKET-5821 > Project: Wicket > Issue Type: Bug > Reporter: Kamil > > What is the point in firing AjaxButton#onSubmit() before Form#onSubmit() > since form components are not yet properly configured? > For example I have an complex component which consists of inner Form. > In InnerForm#onSubmit() (which doesn't know about parent form) I'm setting up > a complex model. > {code} > InnerForm#onSubmit(){ > Obejct modelObject = computeModelObjectFromManyFields(); > MyFormComponent.this.setModelObject(modelObject); > } > {code} > Then I have an outer form in MyClass that contains MyFormComponent and an > AjaxButton > {code} > protected void onInitialize() { > form = new Form("form") > form.add(new MyFormComponent("component", myComplexModel); > form.add(new IndicatingAjaxButton("button", form){ > protected void onSubmit(AjaxRequestTarget target, Form<?> form) > MyClass.this.formSubmitted(target); > } > }); > add(form); > } > protected void formSubmitted(AjaxRequestTarget target){ > doSomethingWithTarget(target); > doSomething(myComplexModel.getObject()); > } > {code} > Unfortunatelly because AjaxButton#onSubmit() is called before > InnerForm.onSubmit() in myComplexModel.getObject() I obtain null instead of > computed object. > Could you please fix this behaviour? > Kind regards -- This message was sent by Atlassian JIRA (v6.3.4#6332)