• Alvin Zhou 36
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies

I have two validation rules on a custom object, and I am trying to display all the failed validation rules at once in my visualforce page.

 

I am using <apex:pageMessages/> to render all the messages at once at the top of the page.

And I am catching the Exception in Apex as follows:

try { insert mycustomobject; } catch(Exception ex) { ApexPages.addMessages(ex); }

 

I entered the criteria in my fields which will cause both the validations to fail, but when I try to save only ONE validation error is displayed, when I fix the erro causing field and save again only then the second validation error is displayed. WHY is it so? when the docs clearly say,  "When one validation rule fails, Salesforce continues to check any additional validation rules on that field or any other field on the page and displays all appropriate error messages at once." 

https://login.salesforce.com/help/doc/en/fields_validation_considerations.htm

 

 

  • September 09, 2011
  • Like
  • 0