You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Matej Knopp <ma...@knopp.sk> on 2006/11/06 17:51:58 UTC

[Vote] Should submit of outer forms process inner forms?

Hi.

As you may have noticed, we have nested forms support in Wicket 2.0.

(Please, this is not about whether we should/should not support nested 
forms, so don't discuss it in this thread).

The question is, what should happen with inner forms, when outer forms 
are submitted.

a) Inner forms should be processed, calling onSubmit() on each of them
b) Inner forms should not be processed, just preserving user input is fine.
c) Make this configurable per form,
    e.g. each form would have method like processOnParentSubmit(), which 
could return true, which would cause this form to be processed, when a 
form in parent hierarchy is submitted.

I vote for C.

-Matej

Re: Re: [Vote] Should submit of outer forms process inner forms?

Posted by Dirk Markert <di...@gmail.com>.
I like the simple solution:

b) Inner forms should not be processed, just preserving user input is fine.

Dirk

Re: Re: [Vote] Should submit of outer forms process inner forms?

Posted by Frank Bille <fr...@gmail.com>.
well, and in our application we *mostly* uses the button.onsubmit but for a
search field we use the form.onsubmit.

Frank


On 11/6/06, Martijn Dashorst <ma...@gmail.com> wrote:
>
> Typically I never have more than one button on a form that matters:
> save. This is then the submit button (no wicket component), and the
> cancel is just a link. So I've probably  never implemented
> button.onSubmit() other then for examples.
>
> Martijn
>
> On 11/6/06, Igor Vaynberg <ig...@gmail.com> wrote:
> > fwiw, in my time as a wicket dev/user i dont think ive ever overridden
> > form.onsubmit(), i always put that behavior into the button's
> onsubmit().
> >
> > -igor
> >
> > On 11/6/06, Martijn Dashorst <ma...@gmail.com> wrote:
> > >
> > > C with default value 'false' -> default does not process inner form.
> > > IMO a form in a panel is not *typically* designed for processing in an
> > > outer form.
> > >
> > > Take for instance:
> > >
> > > Form outer = new Form(this, "outer") {
> > >     protected void onSubmit() {
> > >         session.save(getModelObject());
> > >     }
> > > }
> > >
> > > Form inner0 = new Form(outer, "inner0") {
> > >     protected boolean processOnParentSubmit() {
> > >         return false;
> > >     }
> > >     protected void onSubmit() {
> > >         session.save(getModelObject());
> > >     }
> > > }
> > >
> > > Form inner1 = new Form(outer, "inner1") {
> > >     protected boolean processOnParentSubmit() {
> > >         return false;
> > >     }
> > >     protected void onSubmit() {
> > >         session.save(getModelObject());
> > >     }
> > > }
> > >
> > > Form inner2 = new Form(inner1, "inner2") {
> > >     protected void onSubmit() {
> > >         session.save(getModelObject());
> > >     }
> > > }
> > >
> > > This could lead to double saves, or save and delete, or any other
> > > strange behavior. Setting the default to process inner form breaks the
> > > encapsulation of the form.
> > >
> > > Also what is the semantics of the flag on inner form 1 with regards to
> > > the processing of inner form 2?
> > >
> > > Martijn
> > >
> > > On 11/6/06, Matej Knopp <ma...@knopp.sk> wrote:
> > > > Hi.
> > > >
> > > > As you may have noticed, we have nested forms support in Wicket 2.0.
> > > >
> > > > (Please, this is not about whether we should/should not support
> nested
> > > > forms, so don't discuss it in this thread).
> > > >
> > > > The question is, what should happen with inner forms, when outer
> forms
> > > > are submitted.
> > > >
> > > > a) Inner forms should be processed, calling onSubmit() on each of
> them
> > > > b) Inner forms should not be processed, just preserving user input
> is
> > > fine.
> > > > c) Make this configurable per form,
> > > >     e.g. each form would have method like processOnParentSubmit(),
> which
> > > > could return true, which would cause this form to be processed, when
> a
> > > > form in parent hierarchy is submitted.
> > > >
> > > > I vote for C.
> > > >
> > > > -Matej
> > > >
> > >
> > >
> > > --
> > > <a href="http://www.thebeststuffintheworld.com/vote_for/wicket
> ">Vote</a>
> > > for <a href="http://www.thebeststuffintheworld.com/stuff/wicket
> > > ">Wicket</a>
> > > at the <a href="http://www.thebeststuffintheworld.com/">Best Stuff in
> > > the World!</a>
> > >
> >
> >
>
>
> --
> <a href="http://www.thebeststuffintheworld.com/vote_for/wicket">Vote</a>
> for <a href="http://www.thebeststuffintheworld.com/stuff/wicket
> ">Wicket</a>
> at the <a href="http://www.thebeststuffintheworld.com/">Best Stuff in
> the World!</a>
>

Re: Re: [Vote] Should submit of outer forms process inner forms?

Posted by Martijn Dashorst <ma...@gmail.com>.
Typically I never have more than one button on a form that matters:
save. This is then the submit button (no wicket component), and the
cancel is just a link. So I've probably  never implemented
button.onSubmit() other then for examples.

Martijn

On 11/6/06, Igor Vaynberg <ig...@gmail.com> wrote:
> fwiw, in my time as a wicket dev/user i dont think ive ever overridden
> form.onsubmit(), i always put that behavior into the button's onsubmit().
>
> -igor
>
> On 11/6/06, Martijn Dashorst <ma...@gmail.com> wrote:
> >
> > C with default value 'false' -> default does not process inner form.
> > IMO a form in a panel is not *typically* designed for processing in an
> > outer form.
> >
> > Take for instance:
> >
> > Form outer = new Form(this, "outer") {
> >     protected void onSubmit() {
> >         session.save(getModelObject());
> >     }
> > }
> >
> > Form inner0 = new Form(outer, "inner0") {
> >     protected boolean processOnParentSubmit() {
> >         return false;
> >     }
> >     protected void onSubmit() {
> >         session.save(getModelObject());
> >     }
> > }
> >
> > Form inner1 = new Form(outer, "inner1") {
> >     protected boolean processOnParentSubmit() {
> >         return false;
> >     }
> >     protected void onSubmit() {
> >         session.save(getModelObject());
> >     }
> > }
> >
> > Form inner2 = new Form(inner1, "inner2") {
> >     protected void onSubmit() {
> >         session.save(getModelObject());
> >     }
> > }
> >
> > This could lead to double saves, or save and delete, or any other
> > strange behavior. Setting the default to process inner form breaks the
> > encapsulation of the form.
> >
> > Also what is the semantics of the flag on inner form 1 with regards to
> > the processing of inner form 2?
> >
> > Martijn
> >
> > On 11/6/06, Matej Knopp <ma...@knopp.sk> wrote:
> > > Hi.
> > >
> > > As you may have noticed, we have nested forms support in Wicket 2.0.
> > >
> > > (Please, this is not about whether we should/should not support nested
> > > forms, so don't discuss it in this thread).
> > >
> > > The question is, what should happen with inner forms, when outer forms
> > > are submitted.
> > >
> > > a) Inner forms should be processed, calling onSubmit() on each of them
> > > b) Inner forms should not be processed, just preserving user input is
> > fine.
> > > c) Make this configurable per form,
> > >     e.g. each form would have method like processOnParentSubmit(), which
> > > could return true, which would cause this form to be processed, when a
> > > form in parent hierarchy is submitted.
> > >
> > > I vote for C.
> > >
> > > -Matej
> > >
> >
> >
> > --
> > <a href="http://www.thebeststuffintheworld.com/vote_for/wicket">Vote</a>
> > for <a href="http://www.thebeststuffintheworld.com/stuff/wicket
> > ">Wicket</a>
> > at the <a href="http://www.thebeststuffintheworld.com/">Best Stuff in
> > the World!</a>
> >
>
>


-- 
<a href="http://www.thebeststuffintheworld.com/vote_for/wicket">Vote</a>
for <a href="http://www.thebeststuffintheworld.com/stuff/wicket">Wicket</a>
at the <a href="http://www.thebeststuffintheworld.com/">Best Stuff in
the World!</a>

Re: [Vote] Should submit of outer forms process inner forms?

Posted by Igor Vaynberg <ig...@gmail.com>.
fwiw, in my time as a wicket dev/user i dont think ive ever overridden
form.onsubmit(), i always put that behavior into the button's onsubmit().

-igor

On 11/6/06, Martijn Dashorst <ma...@gmail.com> wrote:
>
> C with default value 'false' -> default does not process inner form.
> IMO a form in a panel is not *typically* designed for processing in an
> outer form.
>
> Take for instance:
>
> Form outer = new Form(this, "outer") {
>     protected void onSubmit() {
>         session.save(getModelObject());
>     }
> }
>
> Form inner0 = new Form(outer, "inner0") {
>     protected boolean processOnParentSubmit() {
>         return false;
>     }
>     protected void onSubmit() {
>         session.save(getModelObject());
>     }
> }
>
> Form inner1 = new Form(outer, "inner1") {
>     protected boolean processOnParentSubmit() {
>         return false;
>     }
>     protected void onSubmit() {
>         session.save(getModelObject());
>     }
> }
>
> Form inner2 = new Form(inner1, "inner2") {
>     protected void onSubmit() {
>         session.save(getModelObject());
>     }
> }
>
> This could lead to double saves, or save and delete, or any other
> strange behavior. Setting the default to process inner form breaks the
> encapsulation of the form.
>
> Also what is the semantics of the flag on inner form 1 with regards to
> the processing of inner form 2?
>
> Martijn
>
> On 11/6/06, Matej Knopp <ma...@knopp.sk> wrote:
> > Hi.
> >
> > As you may have noticed, we have nested forms support in Wicket 2.0.
> >
> > (Please, this is not about whether we should/should not support nested
> > forms, so don't discuss it in this thread).
> >
> > The question is, what should happen with inner forms, when outer forms
> > are submitted.
> >
> > a) Inner forms should be processed, calling onSubmit() on each of them
> > b) Inner forms should not be processed, just preserving user input is
> fine.
> > c) Make this configurable per form,
> >     e.g. each form would have method like processOnParentSubmit(), which
> > could return true, which would cause this form to be processed, when a
> > form in parent hierarchy is submitted.
> >
> > I vote for C.
> >
> > -Matej
> >
>
>
> --
> <a href="http://www.thebeststuffintheworld.com/vote_for/wicket">Vote</a>
> for <a href="http://www.thebeststuffintheworld.com/stuff/wicket
> ">Wicket</a>
> at the <a href="http://www.thebeststuffintheworld.com/">Best Stuff in
> the World!</a>
>

Re: [Vote] Should submit of outer forms process inner forms?

Posted by Martijn Dashorst <ma...@gmail.com>.
C with default value 'false' -> default does not process inner form.
IMO a form in a panel is not *typically* designed for processing in an
outer form.

Take for instance:

Form outer = new Form(this, "outer") {
    protected void onSubmit() {
        session.save(getModelObject());
    }
}

Form inner0 = new Form(outer, "inner0") {
    protected boolean processOnParentSubmit() {
        return false;
    }
    protected void onSubmit() {
        session.save(getModelObject());
    }
}

Form inner1 = new Form(outer, "inner1") {
    protected boolean processOnParentSubmit() {
        return false;
    }
    protected void onSubmit() {
        session.save(getModelObject());
    }
}

Form inner2 = new Form(inner1, "inner2") {
    protected void onSubmit() {
        session.save(getModelObject());
    }
}

This could lead to double saves, or save and delete, or any other
strange behavior. Setting the default to process inner form breaks the
encapsulation of the form.

Also what is the semantics of the flag on inner form 1 with regards to
the processing of inner form 2?

Martijn

On 11/6/06, Matej Knopp <ma...@knopp.sk> wrote:
> Hi.
>
> As you may have noticed, we have nested forms support in Wicket 2.0.
>
> (Please, this is not about whether we should/should not support nested
> forms, so don't discuss it in this thread).
>
> The question is, what should happen with inner forms, when outer forms
> are submitted.
>
> a) Inner forms should be processed, calling onSubmit() on each of them
> b) Inner forms should not be processed, just preserving user input is fine.
> c) Make this configurable per form,
>     e.g. each form would have method like processOnParentSubmit(), which
> could return true, which would cause this form to be processed, when a
> form in parent hierarchy is submitted.
>
> I vote for C.
>
> -Matej
>


-- 
<a href="http://www.thebeststuffintheworld.com/vote_for/wicket">Vote</a>
for <a href="http://www.thebeststuffintheworld.com/stuff/wicket">Wicket</a>
at the <a href="http://www.thebeststuffintheworld.com/">Best Stuff in
the World!</a>

Re: [Vote] Should submit of outer forms process inner forms?

Posted by Eelco Hillenius <ee...@gmail.com>.
I vote for C

Eelco


On 11/6/06, Matej Knopp <ma...@knopp.sk> wrote:
> Hi.
>
> As you may have noticed, we have nested forms support in Wicket 2.0.
>
> (Please, this is not about whether we should/should not support nested
> forms, so don't discuss it in this thread).
>
> The question is, what should happen with inner forms, when outer forms
> are submitted.
>
> a) Inner forms should be processed, calling onSubmit() on each of them
> b) Inner forms should not be processed, just preserving user input is fine.
> c) Make this configurable per form,
>     e.g. each form would have method like processOnParentSubmit(), which
> could return true, which would cause this form to be processed, when a
> form in parent hierarchy is submitted.
>
> I vote for C.
>
> -Matej
>

Re: Re: [Vote] Should submit of outer forms process inner forms?

Posted by Martijn Dashorst <ma...@gmail.com>.
Vote summary:

4 times C (of which 2 with a default for false)
1 times B

Martijn

On 11/7/06, Johan Compagner <jc...@gmail.com> wrote:
> C: default return false.
>
> johan
>
>
> On 11/6/06, Matej Knopp <ma...@knopp.sk> wrote:
> >
> > Hi.
> >
> > As you may have noticed, we have nested forms support in Wicket 2.0.
> >
> > (Please, this is not about whether we should/should not support nested
> > forms, so don't discuss it in this thread).
> >
> > The question is, what should happen with inner forms, when outer forms
> > are submitted.
> >
> > a) Inner forms should be processed, calling onSubmit() on each of them
> > b) Inner forms should not be processed, just preserving user input is
> > fine.
> > c) Make this configurable per form,
> >     e.g. each form would have method like processOnParentSubmit(), which
> > could return true, which would cause this form to be processed, when a
> > form in parent hierarchy is submitted.
> >
> > I vote for C.
> >
> > -Matej
> >
>
>


-- 
<a href="http://www.thebeststuffintheworld.com/vote_for/wicket">Vote</a>
for <a href="http://www.thebeststuffintheworld.com/stuff/wicket">Wicket</a>
at the <a href="http://www.thebeststuffintheworld.com/">Best Stuff in
the World!</a>

Re: [Vote] Should submit of outer forms process inner forms?

Posted by Johan Compagner <jc...@gmail.com>.
C: default return false.

johan


On 11/6/06, Matej Knopp <ma...@knopp.sk> wrote:
>
> Hi.
>
> As you may have noticed, we have nested forms support in Wicket 2.0.
>
> (Please, this is not about whether we should/should not support nested
> forms, so don't discuss it in this thread).
>
> The question is, what should happen with inner forms, when outer forms
> are submitted.
>
> a) Inner forms should be processed, calling onSubmit() on each of them
> b) Inner forms should not be processed, just preserving user input is
> fine.
> c) Make this configurable per form,
>     e.g. each form would have method like processOnParentSubmit(), which
> could return true, which would cause this form to be processed, when a
> form in parent hierarchy is submitted.
>
> I vote for C.
>
> -Matej
>

Re: [Vote] Should submit of outer forms process inner forms?

Posted by Matej Knopp <ma...@knopp.sk>.
Frank Bille wrote:
> I think for completeness we should have:
> 
> d) Throw a RuntimeException when nested forms are detected, because
> it's not allowed in HTML.
No we shouldn't. If you want to discuss this, go ahead, but in a 
different thread. :)

-Matej
> 
> But personally I vote for (C)
> 
> Frank
> 
> On 11/6/06, Igor Vaynberg <ig...@gmail.com> wrote:
>> imho it is the inner forms that knowsif they were designed to be 
>> embeddable
>> or not, so i am for (c)
>>
>> -igor
>>
>>
>> On 11/6/06, Matej Knopp <ma...@knopp.sk> wrote:
>> >
>> > Hi.
>> >
>> > As you may have noticed, we have nested forms support in Wicket 2.0.
>> >
>> > (Please, this is not about whether we should/should not support nested
>> > forms, so don't discuss it in this thread).
>> >
>> > The question is, what should happen with inner forms, when outer forms
>> > are submitted.
>> >
>> > a) Inner forms should be processed, calling onSubmit() on each of them
>> > b) Inner forms should not be processed, just preserving user input is
>> > fine.
>> > c) Make this configurable per form,
>> >     e.g. each form would have method like processOnParentSubmit(), 
>> which
>> > could return true, which would cause this form to be processed, when a
>> > form in parent hierarchy is submitted.
>> >
>> > I vote for C.
>> >
>> > -Matej
>> >
>>
>>
> 


Re: [Vote] Should submit of outer forms process inner forms?

Posted by Frank Bille <fr...@gmail.com>.
I think for completeness we should have:

d) Throw a RuntimeException when nested forms are detected, because
it's not allowed in HTML.

But personally I vote for (C)

Frank

On 11/6/06, Igor Vaynberg <ig...@gmail.com> wrote:
> imho it is the inner forms that knowsif they were designed to be embeddable
> or not, so i am for (c)
>
> -igor
>
>
> On 11/6/06, Matej Knopp <ma...@knopp.sk> wrote:
> >
> > Hi.
> >
> > As you may have noticed, we have nested forms support in Wicket 2.0.
> >
> > (Please, this is not about whether we should/should not support nested
> > forms, so don't discuss it in this thread).
> >
> > The question is, what should happen with inner forms, when outer forms
> > are submitted.
> >
> > a) Inner forms should be processed, calling onSubmit() on each of them
> > b) Inner forms should not be processed, just preserving user input is
> > fine.
> > c) Make this configurable per form,
> >     e.g. each form would have method like processOnParentSubmit(), which
> > could return true, which would cause this form to be processed, when a
> > form in parent hierarchy is submitted.
> >
> > I vote for C.
> >
> > -Matej
> >
>
>

Re: [Vote] Should submit of outer forms process inner forms?

Posted by Igor Vaynberg <ig...@gmail.com>.
imho it is the inner forms that knowsif they were designed to be embeddable
or not, so i am for (c)

-igor


On 11/6/06, Matej Knopp <ma...@knopp.sk> wrote:
>
> Hi.
>
> As you may have noticed, we have nested forms support in Wicket 2.0.
>
> (Please, this is not about whether we should/should not support nested
> forms, so don't discuss it in this thread).
>
> The question is, what should happen with inner forms, when outer forms
> are submitted.
>
> a) Inner forms should be processed, calling onSubmit() on each of them
> b) Inner forms should not be processed, just preserving user input is
> fine.
> c) Make this configurable per form,
>     e.g. each form would have method like processOnParentSubmit(), which
> could return true, which would cause this form to be processed, when a
> form in parent hierarchy is submitted.
>
> I vote for C.
>
> -Matej
>