Visualforce page is displaying one error message at a time not all error messages if validation is failed for all fields.Below is my code in the controller.I have apex:pagemessages in visualforce page is display error messages
if((newFR.Fleet_Vehicle_Maintained__c == 'No')&& (newFR.Fleet_Explanation__c == NULL )) {
newFR.Fleet_Explanation__c.addError('If the fleet vehicle is not being maintained by the rep, an explanation is required.');
return null;
}
if((newFR.Rep_Policy__c == 'No')&& (newFR.Not_Policy_Explanation__c == NULL )) {
newFR.Not_Policy_Explanation__c.addError('Not_Following_Policy_Explanation__c');
return null;
}
if((newFR.FR_Status__c == 'Send for Representative')&& (newFR.Review_Date__c > system.today() )) {
newFR.Review_Date__c.addError('Review Date cannot be a future date when sending for acknowledgement.');
return null;
}