Hi,

By doing the Unit Test, I realized that a *middle* form having
#wantSubmitOnParentFormSubmit false did not prevent an *inner* form from
being "submitted" (*outer* is being submitted in this case)

The problem is in #delegateSubmit which uses a visitPostOrder (inner to
outer), so we cannot stop the visitor...
I think this can be easily solved just by checking the FLAG_SUBMITTED,
which is set at the very beginning of a form submission
(#markFormsSubmitted) with the exact same condition.

The code (and unit test) now looks like:
https://github.com/apache/wicket/commit/c04d341869a0928a556c0bb35ba06621a93e7a51

Please have a cautious look, in case I would have missed something...

Thanks & best regards,
Sebastien.



On Mon, Apr 20, 2015 at 3:00 PM, Sebastien <seb...@gmail.com> wrote:

> > Is there any reason why the #wantSubmitOnXyz() methods should be public
> and
> not protected?
>
> I prefer to be protected too, but as #wantSubmitOnNestedFormSubmit was
> public, I aligned on that.
>
>
>
>
> On Mon, Apr 20, 2015 at 2:53 PM, Martin Grigorov <mgrigo...@apache.org>
> wrote:
>
>> Hi,
>>
>> Looks OK to me.
>> Please add unit (WicketTester) tests for it.
>>
>> Is there any reason why the #wantSubmitOnXyz() methods should be public
>> and
>> not protected?
>> @Carl-Eric: I think you added #wantSubmitOnNestedFormSubmit(). Any problem
>> if this is protected in 7.x?
>>
>> Martin Grigorov
>> Wicket Training and Consulting
>> https://twitter.com/mtgrigorov
>>
>> On Mon, Apr 20, 2015 at 3:44 PM, Sebastien <seb...@gmail.com> wrote:
>>
>> > Hi devs,
>> >
>> > I have a recurrent use case where I need to prevent a nested form to be
>> > processed/validated/submitted. There is already some conditions that
>> could
>> > achieve this (Form#isEnabledInHierarchy or #isVisibleInHierarchy), but
>> it
>> > does not suit well in case of a component/widget which is shown/hidden
>> > using javascript only (like a Dialog for instance).
>> >
>> > Form has a #wantSubmitOnNestedFormSubmit method (default to false),
>> which
>> > allows to submit a parent form when the nested form is posted. I was
>> > thinking about having a #wantSubmitOnParentFormSubmit (default to true)
>> > which does the opposite: preventing a nested form to be submitted.
>> >
>> > You can see the code proposal here:
>> >
>> >
>> https://github.com/apache/wicket/commit/e29a7a08a59c9897dcaf3f5df1661cc03a04b644
>> >
>> > (btw, there is/was an error L1014/1025)
>> >
>> > What do you think?
>> >
>> > Best regards,
>> > Sebastien.
>> >
>>
>
>

Reply via email to