Hi,

this is somehow related to WICKET-6041
<https://issues.apache.org/jira/browse/WICKET-6041>. Unfortunately we
couldn't find a solution for this old issue.

On Mon, Aug 21, 2017 at 12:55 AM, Vit Rozkovec <vit.rozko...@gmail.com>
wrote:

> Hi,
>
> I think I have discovered a bug where inner form, when set
> wantSubmitOnParentFormSubmit() to false, does not get submitted when used
> with AjaxButton. Normal SubmitLink works.
>
> Please see attached quickstart for demonstration.
>
> I believe the problem is in Form's onFormSubmitted(IFormSubmitter
> submitter) and markFormsSubmitted()
>
> When used with Ajax, onFormSubmitted gets called for parent form in
> AjaxFormSubmitBehavior:
>
> *    @Override*
> *    protected void onEvent(final AjaxRequestTarget target)*
> *    {*
> *        getForm().getRootForm().onFormSubmitted(new
> AjaxFormSubmitBehavior.AjaxFormSubmitter(this, target));*
> *    }*
>
> onFormSubmitted calls markFormsSubmitted but this implementation:
>
> *    private void markFormsSubmitted()*
> *    {*
> *        setFlag(FLAG_SUBMITTED, true);*
>
> *        visitChildren(Form.class, new IVisitor<Component, Void>()*
> *        {*
> *            @Override*
> *            public void component(final Component component, final
> IVisit<Void> visit)*
> *            {*
> *                Form<?> form = (Form<?>)component;*
> *                if (form.wantSubmitOnParentFormSubmit() &&
> form.isEnabledInHierarchy() && form.isVisibleInHierarchy())*
> *                {*
> *                    form.setFlag(FLAG_SUBMITTED, true);*
> *                    return;*
> *                }*
> *                visit.dontGoDeeper();*
> *            }*
> *        });*
> *    }*
>
> skips the inner form with wantSubmitOnParentFormSubmit set to false.
>
> Further down the road delegateSubmit collects forms that have been
> submitted, but as this inner form was skipped and flag was not set, it does
> not call form's onSubmit method.
>
> My use case is having one large form and ajax subform that works as
> add/list comments form for parent large form.
>
> Am I missing something?
>
> Thanks for looking into it.
>
> Vit
>

Reply via email to