function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sandy singhSandy singh 

Display warning message on filed level

Hi all,

 

I want display warning message on filed level [Requirement: if date field is less then current date show warning message  on that filed and allow user to enter the data].

 

Please help me on this issue.

 

Regards,

Sandy

RanjeetRanjeet

Hi Sandy,

 

If you want to display error message below the field, you can create validation rule for that and select the field in 'Error Location' in the bottom of the validation rule page.

Sandy singhSandy singh

Hi ranjeet,

 

 Thanks for solution but my requirement is to display warning message not error message. so that if condition is true it show warning message and then allow to proccess.

 

Thanks,

Sandy

ngabraningabrani

For error handling you can add apex:messages should be added to the Visualforce page and then use something like this in the controller:

if (ErrorCondition == true){
    ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR,’Add your message here’);
    ApexPages.addMessage(myMsg);
    return null;
}

 

Link to Salesforce documentation --

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_pages_message.htm

 

 

TejTej

  ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.Warning,’Add your message here’);

 

Replace the .Severity.Error with .Severity.Warning.