You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Andrew Geery <an...@gmail.com> on 2015/01/22 12:51:44 UTC

validating a form that is not visible

I have a top-level form.

The top-level form contains two nested forms.

The nested forms are inside of a TabbedPanel so only one is visible at a
time.

The save button for the top-level form is always visible.  The save button
submits the top-level form and submitting the top-level form also has the
effect of submitting the nested forms.

This all is correct and works as it should.

The issue is that Wicket (correctly) only validates the form that is on the
tab that is visible.  The form that is on the tab that is not visible is
not actually being submitted so it doesn't get validated.

In the past, I've prevented the user from switching tabs if one of the tabs
contained a validation error, but I can't do that in this case.

When the top-level form is submitted, is there a way I can mark both forms
as visible and have Wicket validate both forms?

Thanks
Andrew

Re: validating a form that is not visible

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
Use a client side TAB...? So, visibility is handled at the client

On Thu, Jan 22, 2015 at 11:51 AM, Andrew Geery <an...@gmail.com>
wrote:

> I have a top-level form.
>
> The top-level form contains two nested forms.
>
> The nested forms are inside of a TabbedPanel so only one is visible at a
> time.
>
> The save button for the top-level form is always visible.  The save button
> submits the top-level form and submitting the top-level form also has the
> effect of submitting the nested forms.
>
> This all is correct and works as it should.
>
> The issue is that Wicket (correctly) only validates the form that is on the
> tab that is visible.  The form that is on the tab that is not visible is
> not actually being submitted so it doesn't get validated.
>
> In the past, I've prevented the user from switching tabs if one of the tabs
> contained a validation error, but I can't do that in this case.
>
> When the top-level form is submitted, is there a way I can mark both forms
> as visible and have Wicket validate both forms?
>
> Thanks
> Andrew
>



-- 
Regards - Ernesto Reinaldo Barreiro

Re: validating a form that is not visible

Posted by Andrew Geery <an...@gmail.com>.
Thanks so much for the info and the pointers!

Andrew

On Thu, Jan 22, 2015 at 7:03 AM, Ernesto Reinaldo Barreiro <
reiern70@gmail.com> wrote:

> e.g.
>
>
> https://github.com/reiern70/wicket-bootstrap/blob/master/bootstrap-core/src/main/java/de/agilecoders/wicket/core/markup/html/bootstrap/tabs/ClientSideBootstrapTabbedPanel.java
>
> On Thu, Jan 22, 2015 at 11:57 AM, Martin Grigorov <mg...@apache.org>
> wrote:
>
> > Hi,
> >
> > I think you will need to write custom tabbed panel that hides the tabs
> with
> > JS on the client side.
> >
> > The problem with Wicket's default TabbedPanel is that it sees only one
> tab
> > at a time - the active tab.
> > I.e. the component tree is something like
> > "...form:tabbedPanel:content:nestedFormX:..."
> > Switching the tabs replaces the content component and thus nestedFormX
> > becomes nestedFormY.
> >
> > Martin Grigorov
> > Wicket Training and Consulting
> > https://twitter.com/mtgrigorov
> >
> > On Thu, Jan 22, 2015 at 1:51 PM, Andrew Geery <an...@gmail.com>
> > wrote:
> >
> > > I have a top-level form.
> > >
> > > The top-level form contains two nested forms.
> > >
> > > The nested forms are inside of a TabbedPanel so only one is visible at
> a
> > > time.
> > >
> > > The save button for the top-level form is always visible.  The save
> > button
> > > submits the top-level form and submitting the top-level form also has
> the
> > > effect of submitting the nested forms.
> > >
> > > This all is correct and works as it should.
> > >
> > > The issue is that Wicket (correctly) only validates the form that is on
> > the
> > > tab that is visible.  The form that is on the tab that is not visible
> is
> > > not actually being submitted so it doesn't get validated.
> > >
> > > In the past, I've prevented the user from switching tabs if one of the
> > tabs
> > > contained a validation error, but I can't do that in this case.
> > >
> > > When the top-level form is submitted, is there a way I can mark both
> > forms
> > > as visible and have Wicket validate both forms?
> > >
> > > Thanks
> > > Andrew
> > >
> >
>
>
>
> --
> Regards - Ernesto Reinaldo Barreiro
>

Re: validating a form that is not visible

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
e.g.

https://github.com/reiern70/wicket-bootstrap/blob/master/bootstrap-core/src/main/java/de/agilecoders/wicket/core/markup/html/bootstrap/tabs/ClientSideBootstrapTabbedPanel.java

On Thu, Jan 22, 2015 at 11:57 AM, Martin Grigorov <mg...@apache.org>
wrote:

> Hi,
>
> I think you will need to write custom tabbed panel that hides the tabs with
> JS on the client side.
>
> The problem with Wicket's default TabbedPanel is that it sees only one tab
> at a time - the active tab.
> I.e. the component tree is something like
> "...form:tabbedPanel:content:nestedFormX:..."
> Switching the tabs replaces the content component and thus nestedFormX
> becomes nestedFormY.
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Thu, Jan 22, 2015 at 1:51 PM, Andrew Geery <an...@gmail.com>
> wrote:
>
> > I have a top-level form.
> >
> > The top-level form contains two nested forms.
> >
> > The nested forms are inside of a TabbedPanel so only one is visible at a
> > time.
> >
> > The save button for the top-level form is always visible.  The save
> button
> > submits the top-level form and submitting the top-level form also has the
> > effect of submitting the nested forms.
> >
> > This all is correct and works as it should.
> >
> > The issue is that Wicket (correctly) only validates the form that is on
> the
> > tab that is visible.  The form that is on the tab that is not visible is
> > not actually being submitted so it doesn't get validated.
> >
> > In the past, I've prevented the user from switching tabs if one of the
> tabs
> > contained a validation error, but I can't do that in this case.
> >
> > When the top-level form is submitted, is there a way I can mark both
> forms
> > as visible and have Wicket validate both forms?
> >
> > Thanks
> > Andrew
> >
>



-- 
Regards - Ernesto Reinaldo Barreiro

Re: validating a form that is not visible

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

I think you will need to write custom tabbed panel that hides the tabs with
JS on the client side.

The problem with Wicket's default TabbedPanel is that it sees only one tab
at a time - the active tab.
I.e. the component tree is something like
"...form:tabbedPanel:content:nestedFormX:..."
Switching the tabs replaces the content component and thus nestedFormX
becomes nestedFormY.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Thu, Jan 22, 2015 at 1:51 PM, Andrew Geery <an...@gmail.com>
wrote:

> I have a top-level form.
>
> The top-level form contains two nested forms.
>
> The nested forms are inside of a TabbedPanel so only one is visible at a
> time.
>
> The save button for the top-level form is always visible.  The save button
> submits the top-level form and submitting the top-level form also has the
> effect of submitting the nested forms.
>
> This all is correct and works as it should.
>
> The issue is that Wicket (correctly) only validates the form that is on the
> tab that is visible.  The form that is on the tab that is not visible is
> not actually being submitted so it doesn't get validated.
>
> In the past, I've prevented the user from switching tabs if one of the tabs
> contained a validation error, but I can't do that in this case.
>
> When the top-level form is submitted, is there a way I can mark both forms
> as visible and have Wicket validate both forms?
>
> Thanks
> Andrew
>