You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by "Knaack, Ulrich" <Ul...@lgln.niedersachsen.de> on 2017/05/03 12:19:05 UTC

Modal dialog, form validation in AjaxBootstrapTabbedPanel

Hi,	

I've to create a modal dialog which contains a AjaxBootstrapTabbedPanel with two or more tabs.
All tabs belong to the same form. Each tab contains required input fields, select boxes
or drop down choices. Until now, I don't use own validators, but this is a future task.

I was able to trigger the validation when switching between the tabs.

When I use the dialog like variant A and B, I get proper feedback from validation.

Variant A
    1. open the dialog
    2. closing the dialog via submit button immediately results in feedback message "please enter a value in field..."

Variant B
    1. open the dialog
    2. switch to another tab without filling required fields on initial tab gives also "please enter a value in ..."

Variant C - validation problem
Using the dialog in this way doesn't result in feedback messages:
    1. open the dialog
    2. enter all required values on the initial tab
    3. don't enter values in required fields on another tab
    4. use the submit button to close the diaolg: no feedback message!!, but there has to be one or more

In Variant C, no logging output from the method BootstrapAjaxButton#onError() is printed.

I'm using Wicket 7.6.0 and Wicket-Bootstrap 0.10.11

The attachement contains a MCVE which can be run via test class StartTryOut.


Regards,
Ulrich Knaack

Landesamt f�r Geoinformation und Landesvermessung Niedersachsen (LGLN)
- Landesvermessung und Geobasisinformation - Landesbetrieb -
Fachgebiet 224 - Geodateninfrastruktur
Podbielskistra�e 331, 30659 Hannover
Tel.:	 +49 511 64609-287
Fax:	 +49 511 64609-161
mailto:ulrich.knaack@lgln.niedersachsen.de
www.lgln.niedersachsen.de


Re: Modal dialog, form validation in AjaxBootstrapTabbedPanel

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

I think I see the problem.
When using AjaxBootstrapTabbedPanel the tabs' content is loaded one at a
time. This makes it hard to validate the complete form because not all
fields are available at any time.
You may need to use
https://github.com/l0rdn1kk0n/wicket-bootstrap/blob/wicket-7.x/bootstrap-core/src/main/java/de/agilecoders/wicket/core/markup/html/bootstrap/tabs/ClientSideBootstrapTabbedPanel.java
instead. It will switch the tabs
via JavaScript and make the validation once you use the submit button.
If this doesn't help you then I'll try to take a look at your application
after work!

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

On Wed, May 3, 2017 at 2:19 PM, Knaack, Ulrich <
Ulrich.Knaack@lgln.niedersachsen.de> wrote:

> Hi,
>
> I've to create a modal dialog which contains a AjaxBootstrapTabbedPanel
> with two or more tabs.
> All tabs belong to the same form. Each tab contains required input fields,
> select boxes
> or drop down choices. Until now, I don't use own validators, but this is a
> future task.
>
> I was able to trigger the validation when switching between the tabs.
>
> When I use the dialog like variant A and B, I get proper feedback from
> validation.
>
> Variant A
>     1. open the dialog
>     2. closing the dialog via submit button immediately results in
> feedback message "please enter a value in field..."
>
> Variant B
>     1. open the dialog
>     2. switch to another tab without filling required fields on initial
> tab gives also "please enter a value in ..."
>
> Variant C - validation problem
> Using the dialog in this way doesn't result in feedback messages:
>     1. open the dialog
>     2. enter all required values on the initial tab
>     3. don't enter values in required fields on another tab
>     4. use the submit button to close the diaolg: no feedback message!!,
> but there has to be one or more
>
> In Variant C, no logging output from the method
> BootstrapAjaxButton#onError() is printed.
>
> I'm using Wicket 7.6.0 and Wicket-Bootstrap 0.10.11
>
> The attachement contains a MCVE which can be run via test class
> StartTryOut.
>
>
> Regards,
> Ulrich Knaack
>
> Landesamt für Geoinformation und Landesvermessung Niedersachsen (LGLN)
> - Landesvermessung und Geobasisinformation - Landesbetrieb -
> Fachgebiet 224 - Geodateninfrastruktur
> Podbielskistraße 331, 30659 Hannover
> Tel.:    +49 511 64609-287
> Fax:     +49 511 64609-161
> mailto:ulrich.knaack@lgln.niedersachsen.de
> www.lgln.niedersachsen.de
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>