You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Thomas Götz <to...@decoded.de> on 2012/04/11 15:19:17 UTC

rawInput, page reload and error messages

Hi!

I have the following situation (Wicket 1.5.5):

- a Form with a TextField<String> with some Validator
- you input invalid data and submit -> error message, fine.
- (invalid) rawInput is shown in the TextField, fine.
- now I do a page reload, invalid rawInput still in the TextField, but no error message shown

What I'd like to achieve is that upon a page reload the (invalid) rawInput is shown in the TextField, but the error message also needs to be shown again. How can this be done?

I already tried to trigger validation manually by calling formComponent.validate(), but this calls AbstractTextComponent.convertInput(), which tries to pull the input data from the request (and there is no data because of page reload, so validation won't fail …).

Cheers,
   -Tom


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


Re: rawInput, page reload and error messages

Posted by Dan Retzlaff <dr...@gmail.com>.
You might want to subclass Form to retain additional state. It could save
the validation errors and put them back onto components in onBeforeRender,
clearing them when validation is eventually successful. This could probably
also be accomplished with a Behavior.

On Wed, Apr 11, 2012 at 7:19 AM, Thomas Götz <to...@decoded.de> wrote:

> Hi!
>
> I have the following situation (Wicket 1.5.5):
>
> - a Form with a TextField<String> with some Validator
> - you input invalid data and submit -> error message, fine.
> - (invalid) rawInput is shown in the TextField, fine.
> - now I do a page reload, invalid rawInput still in the TextField, but no
> error message shown
>
> What I'd like to achieve is that upon a page reload the (invalid) rawInput
> is shown in the TextField, but the error message also needs to be shown
> again. How can this be done?
>
> I already tried to trigger validation manually by calling
> formComponent.validate(), but this calls
> AbstractTextComponent.convertInput(), which tries to pull the input data
> from the request (and there is no data because of page reload, so
> validation won't fail …).
>
> Cheers,
>   -Tom
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>