Activity Forums Salesforce® Discussions How To Display Error Message On Visualforce Page?

  • How To Display Error Message On Visualforce Page?

    Posted by Aman on September 20, 2018 at 3:11 pm

    How To Display Error Message On Visualforce Page?

     

    Parul replied 4 years ago 3 Members · 2 Replies
  • 2 Replies
  • shariq

    Member
    September 20, 2018 at 3:14 pm

    Hi,

    In the Visualforce page add the tag:

    <apex:pageMessages />

    In the controller class add the error message where required

    if ( requiredFieldName == null){

    ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'Please enter a value in the Required Field'));

    }

    Thanks

  • Parul

    Member
    September 20, 2018 at 4:13 pm

    Hi

    Display Error message using :

    <apex:pageMessages />

    Thanks.

     

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos