+ Start a Discussion
hikiran rajuhikiran raju 

how to show the validation error message in custom VF page

Hi everyone,
I have created an custom VF page with  std.object and Custom object fields. In that i have an submit button, when submit button is clicked i need to show the error messages for the fields which are mandatory if they are empty and null. How can i show the validation error message in my custom vf page. Can any one help me over here.
Thanks in advance.

Amit Chaudhary 8Amit Chaudhary 8
Please check below post. I hope that will help you
1) http://www.sfdcpoint.com/salesforce/show-error-message-visualforce-page/
2) http://www.infallibletechie.com/2013/04/how-to-add-error-message-in-visualforce.html
3) http://www.infallibletechie.com/2012/10/how-to-display-error-messages-in.html

Visualforce page:
<apex:pageMessages />

Apex Controller:
ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR,'Error Message.');


ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,'Error Message.'));