-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Hibernate validators only for required fileds?
PostPosted: Sat Jul 25, 2009 3:30 pm 
Newbie

Joined: Fri Jul 24, 2009 6:14 am
Posts: 9
Hi!

Are validators like @Digits only for required fields? I can't find anything in the documentation to prevent this validators to bring up error messages on empty fields...

Thank you very much in advance!

Regards,

Anton


Top
 Profile  
 
 Post subject: Re: Hibernate validators only for required fileds?
PostPosted: Sun Jul 26, 2009 8:09 pm 
Newbie

Joined: Fri Mar 21, 2008 11:35 am
Posts: 10
what do you mean by a "required field"?


Top
 Profile  
 
 Post subject: Re: Hibernate validators only for required fileds?
PostPosted: Mon Jul 27, 2009 1:11 am 
Newbie

Joined: Fri Jul 24, 2009 6:14 am
Posts: 9
A mandatory, required input field (fields that the user must enter).

With mandatory fields the validators work (because an empty @Digit field would be wrong, so it should be validated), but with optional fields @Digit validates the empty field and displays an error, that it is no valid digit (but it is valid, because it is empty).

What I miss is something like @Digit(..., allowEmpty = true) - which should be the default because a mandatory/required field will have a @NotEmpty or @NotNull...

Am I blind?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.