You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by wicket_new_user <mu...@gmail.com> on 2012/12/17 08:07:34 UTC

Custom Validation implementation

Hi all, 

Is there a way to do the validation for all the fields in one area without
using onValidate method.

I mean, the form data will be converted to domain data, do the validation
and throw error message if any found before persisting to the database?

Thank You 



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Custom-Validation-implementation-tp4654851.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: Custom Validation implementation

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

Wicket IValidator is used before converting the string sent by the browser
to a domain object. This way if there is a validation error the old (and
correct) value is still in use.
You can achieve your approach by making your validation in #onSubmit().
Here you can work with the domain object but if there is a validation error
then you need to restore the form components' models to the previous
(correct) ones, not only skip the write to the DB.


On Mon, Dec 17, 2012 at 9:07 AM, wicket_new_user <mu...@gmail.com>wrote:

> Hi all,
>
> Is there a way to do the validation for all the fields in one area without
> using onValidate method.
>
> I mean, the form data will be converted to domain data, do the validation
> and throw error message if any found before persisting to the database?
>
> Thank You
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Custom-Validation-implementation-tp4654851.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>