Announcement Announcement Module
Collapse
No announcement yet.
Binding errors vs Validation errors Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    How to remove errors from Errors object

    Hi,
    I'm adding all the field validation errors as follows
    errors.rejectValue(fieldName, errorCode)

    once i add the error based on some logic i want to remove the corresponding error from the 'errors'. How can i remove an added error from the errors object. I searched and not found any remove method on errors to remove the same. Can any one please help on this.

    Comment


    • #17
      Hi

      do you mean that you want to remove errors caused by validation? like required fields or typemismatch errors?

      Comment


      • #18
        yes... exactly.. how to do that.

        Comment


        • #19
          Hi

          sorry for the late reply.

          I could not find a way to remove data binding errors from error object. what I did was something like the following.

          Code:
          		
                          if (!errors.hasFieldErrors("age")){
          			// do validation
          			if (age <= 0){
          				errors.rejectValue("age", "negative");
          
          			}
          		}
          The logical validation is only done when there are no binding errors.

          I did this because I didn't want to show two error messages for the same field.

          when I use the above there will be only one error message for the "age" field

          If you have the same problem then you can do the above until you find how to remove errors from error object

          Comment

          Working...
          X