You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Henrique <qu...@gmail.com> on 2010/11/10 03:31:01 UTC

onSubmit method and validators

Hello, I have a simple form with some RequiredTextFields.

When the user leaves some of them blank, the corresponding messages
show up in the feedback panel telling them they are required.
The issue I am having is that once this happens, the onSubmit() method
is no longer called and wicket starts calling the onError() method.
Since my business logic is inside the onSubmit() method, it never gets called.

How can I work around this issue? A not so elegant solution was to
manually call the onSubmit method inside the onError method, but this
erases the entire form's components with what the user had typed in.

Thanks!

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


SV: onSubmit method and validators

Posted by Wilhelmsen Tor Iver <To...@arrive.no>.
> The issue I am having is that once this happens, the onSubmit() method
> is no longer called and wicket starts calling the onError() method.

Which is as expected: You usually do not want to process a form that fails validation.

> Since my business logic is inside the onSubmit() method, it never gets called.

What business logic do you want to run on invalid form data? Try looking into running that code in some of the other lifecycle-oriented methods like onBeforeRender() or the like.

- Tor Iver