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
abivenkatabivenkat 

small problem, need urgent help!

 

hi all,

 

i am using the <apex:pageMessages /> tag in my vf page on top of the page below the <apex:form> tag. I am adding the below line code

 

ApexPages.addMessage(new ApexPages.message(ApexPages.severity.Error,'Name cannot be empty.'));

 

but, the error message is not populating or showing in the <apex:pageMessages /> tag... what i have to do to get this fixed and am i doing any thin wrong or is there anythin wrong with the syntax?? please help. thanks in advance

 

thanks

abivenkat

SFDC Learner 

UVUV

Can you pls post you code...

 

I tried very simple code and it works-

<apex:page controller="Example">
<apex:form>
  <apex:pageMessages></apex:pageMessages>
  </apex:form>
</apex:page>

 

public class Example
   {
        public Example()
        {
            ApexPages.addMessage(new ApexPages.message(ApexPages.severity.Error,'It will display Error.'));
        }     
   }

pankaj.raijadepankaj.raijade

You need to have Message tag inside tag which rerenders after your event.

 

eg. if you want message on click of button save and on save button you are rerendering pageblock "ABC". Then message tag should be inside page block ABC. 

 

Regards,

Pankaj Raijade.