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

Attachment: formtest.tar.gz
Description: application/gzip

Reply via email to