bval-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Umesh Awasthi <umeshawas...@gmail.com>
Subject Short circuiting constraints on a field (Bean validation)
Date Fri, 11 Oct 2013 10:56:22 GMT
I am wondering about way to enable short circuiting on constraint defined
at field levels.Say i have a field

*Code:*
private Integer phoneNumber;
and i have following validations on phoneNumber
*Code:*
        @Digits(message="not.number")
   @SecondValidation(value=10,message="my message")
        private Integer phoneNumber;


In case i added alphanumeric value less than, i am getting both errors

1. Field should be number.
2. Second Message will also be displayed

Is there any way to tell BV API to not go for other validation if first one
failed (Short circuiting). In short i want to display only first error if
it failed and ignoring any other validation defined on that field / property

Is this feasible?

-
With Regards
Umesh Awasthi
http://www.travellingrants.com/

Mime
View raw message