I have a BindingResult result that has a FieldError registered for the field date. How can I remove this error?
Assume the error was added as result.rejectValue("date", "my_code", "my_message") ;
Thanks in advance
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Well, first of all, BindingResult is an interface, not a concrete class, and the interface doesn’t specify any way to remove an error.
Depending on which implementation of the interface you are dealing with, there may be a method (beyond what’s specified in the BindingResult interface) to do this, but it seems unlikely.
The only thing that I can think of is to create a new BindingResult instance, then loop through the errors and re-create all but the one that you want to ignore in the new one.