You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by es...@husbanken.no on 2010/02/25 13:27:09 UTC
Validate with info messages, instead of errors
Hi all!
I'm Looking for a way to perform validation, but print the messages as
INFO (with Ajax), instead of ERRORs. I'd like to have a combination of
error and info validators. An error will prevent the user from submitting
the form, the info message will give the user a warning/info message. The
messages should popup during an "onblur" event from the component and be
displayed in a way similar to:
http://stuq.nl/weblog/2008-09-03/user-friendly-form-validation-with-wicket
.
I've been looking into extending for instance MaximumValidator and let it
report info messages, unfortunately I'm unable to get hold og the
Component through the IValidatable interface impl. The error message,
which I'd like to use, is built up inside the FromComponents error method
and unavailable for me. Maybe I'm on the wrong the wrong path here?
Anybody that has done something similar?
--
Espen Ønvik Pedersen
Ad: Re: Validate with info messages, instead of errors
Posted by es...@husbanken.no.
Hmm .. you're probably right about your first statement. I still have some
issues with adapting MaximumValidator as it does not give access to the
FormComponent that has this validator attached. So as far as I can see I
have to send the component in as a parameter, which I'd like to avoid.
Also the error message that is created by the validator which available
from within the Validator itself, so I would have to fetch it my self. Not
a big deal I guess if I have the instance object of the FormComponent, but
if possible I'd like to inherit the creation of the messages from
MaximumValidator.
--
Espen Ønvik Pedersen
Fra:
Antoine van Wel <an...@gmail.com>
Til:
users@wicket.apache.org
Dato:
25.02.2010 16:04
Emne:
Re: Validate with info messages, instead of errors
As for the link you show, the author is building something which is
available in the Wicket core, which he seems to have missed or perhaps
it's just an outdated article.
Make a FeedbackPanel for every FormComponent you want to have messages
for and initialize it with a ComponentFeedbackMessageFilter so you
will only see the info/error messages relevant to the FormComponent
you attach that filter to.
I don't really see the problem with adapting a MaximumValidator output
info messages instead of errors, just override validate or copy and
paste the whole thing and adapt it, it's a small class.
Antoine.
On Thu, Feb 25, 2010 at 1:27 PM, <es...@husbanken.no> wrote:
> Hi all!
>
> I'm Looking for a way to perform validation, but print the messages as
> INFO (with Ajax), instead of ERRORs. I'd like to have a combination of
> error and info validators. An error will prevent the user from
submitting
> the form, the info message will give the user a warning/info message.
The
> messages should popup during an "onblur" event from the component and be
> displayed in a way similar to:
>
http://stuq.nl/weblog/2008-09-03/user-friendly-form-validation-with-wicket
> .
>
> I've been looking into extending for instance MaximumValidator and let
it
> report info messages, unfortunately I'm unable to get hold og the
> Component through the IValidatable interface impl. The error message,
> which I'd like to use, is built up inside the FromComponents error
method
> and unavailable for me. Maybe I'm on the wrong the wrong path here?
> Anybody that has done something similar?
>
> --
> Espen Ønvik Pedersen
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Validate with info messages, instead of errors
Posted by Antoine van Wel <an...@gmail.com>.
As for the link you show, the author is building something which is
available in the Wicket core, which he seems to have missed or perhaps
it's just an outdated article.
Make a FeedbackPanel for every FormComponent you want to have messages
for and initialize it with a ComponentFeedbackMessageFilter so you
will only see the info/error messages relevant to the FormComponent
you attach that filter to.
I don't really see the problem with adapting a MaximumValidator output
info messages instead of errors, just override validate or copy and
paste the whole thing and adapt it, it's a small class.
Antoine.
On Thu, Feb 25, 2010 at 1:27 PM, <es...@husbanken.no> wrote:
> Hi all!
>
> I'm Looking for a way to perform validation, but print the messages as
> INFO (with Ajax), instead of ERRORs. I'd like to have a combination of
> error and info validators. An error will prevent the user from submitting
> the form, the info message will give the user a warning/info message. The
> messages should popup during an "onblur" event from the component and be
> displayed in a way similar to:
> http://stuq.nl/weblog/2008-09-03/user-friendly-form-validation-with-wicket
> .
>
> I've been looking into extending for instance MaximumValidator and let it
> report info messages, unfortunately I'm unable to get hold og the
> Component through the IValidatable interface impl. The error message,
> which I'd like to use, is built up inside the FromComponents error method
> and unavailable for me. Maybe I'm on the wrong the wrong path here?
> Anybody that has done something similar?
>
> --
> Espen Ønvik Pedersen
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org