You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Martin Grigorov (JIRA)" <ji...@apache.org> on 2015/01/26 21:20:35 UTC

[jira] [Resolved] (WICKET-5821) Wicket calls AjaxButton#onSubmit() before Form#onSubmit()

     [ https://issues.apache.org/jira/browse/WICKET-5821?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Grigorov resolved WICKET-5821.
-------------------------------------
    Resolution: Not a Problem

Please use the mailing lists for questions.
Thanks!

> 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)