You need to sign in to do that
Don't have an account?
kavya.ax1320
Apex error message through normal function
Hi,
Can a normal function send an apex error message to the Visualforce Page.
EX :
public void abc (){
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.error,'Error!!!!!!));
}
Thanks.
Hi,
No, you cannot send error msg to page from any class. Class must be set either as controller or extensions.
here the context of class does matter.
Hi Alok_vibrant,
I have set the above class a s an controller, but the method which is passing the message to VF shoud it have a return type as "Pagereference" or can it be anything.
Thanks in advance.
Kavya - As i guess this method is being execute on some of the event from page like button click right ?
Return type of method can be either PageReference or void, apart from that you also need to include <apex:pageMessages/> vf tag in the page, probably top of the page.