You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by John Krasnay <jo...@krasnay.ca> on 2008/08/18 22:42:21 UTC
Nested forms
Hi folks,
I find myself occasionally using nested forms in my Wicket apps. With
nested forms, when the outer form is submitted, it triggers a
validation and submission of any inner forms as well. In some
cases I don't want this behaviour, but instead I want the inner form and
outer form to be independent of one another.
The way I've approached this is to put a disabled form in between the
outer form and the inner form, which effectively blocks the outer form's
submission from propagating to the inner form. It works, but it's ugly.
Is there a better way to do this? One thought I had was to make this an
explicit setting on the Form class (e.g.
setIgnoreParentSubmissions(true)), but currently I can't see a better
way to do it.
jk
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Nested forms
Posted by John Krasnay <jo...@krasnay.ca>.
On Tue, Aug 19, 2008 at 09:15:55AM -0400, John Krasnay wrote:
> On Mon, Aug 18, 2008 at 11:10:29PM +0200, Matej Knopp wrote:
> > Can't you just override isEnabled() on the inner form and return
> > true/false depending on whether the inner form should be processed?
> >
>
> Hrm, something like this I suppose?
>
> public boolean isEnabled() {
> return findFormSubmittingButton().getForm() == this;
> }
>
> I'll give it a try. Thanks!
>
> jk
>
It should be like this...
@Override
public boolean isEnabled() {
return getRootForm().findSubmittingButton().getForm() == this;
}
...but it works fine. I've updated the wiki with an example.
Thanks again, Matej.
jk
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Nested forms
Posted by John Krasnay <jo...@krasnay.ca>.
On Mon, Aug 18, 2008 at 11:10:29PM +0200, Matej Knopp wrote:
> Can't you just override isEnabled() on the inner form and return
> true/false depending on whether the inner form should be processed?
>
Hrm, something like this I suppose?
public boolean isEnabled() {
return findFormSubmittingButton().getForm() == this;
}
I'll give it a try. Thanks!
jk
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Nested forms
Posted by Matej Knopp <ma...@gmail.com>.
Can't you just override isEnabled() on the inner form and return
true/false depending on whether the inner form should be processed?
-Matej
On Mon, Aug 18, 2008 at 10:42 PM, John Krasnay <jo...@krasnay.ca> wrote:
> Hi folks,
>
> I find myself occasionally using nested forms in my Wicket apps. With
> nested forms, when the outer form is submitted, it triggers a
> validation and submission of any inner forms as well. In some
> cases I don't want this behaviour, but instead I want the inner form and
> outer form to be independent of one another.
>
> The way I've approached this is to put a disabled form in between the
> outer form and the inner form, which effectively blocks the outer form's
> submission from propagating to the inner form. It works, but it's ugly.
>
> Is there a better way to do this? One thought I had was to make this an
> explicit setting on the Form class (e.g.
> setIgnoreParentSubmissions(true)), but currently I can't see a better
> way to do it.
>
> jk
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org