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
Saurabh AgrahariSaurabh Agrahari 

Apex page messages not showing with Action status

Hi ,
 
I am trying to use action status with apex page Message .Also there is a rendered attribute with apex page message .Below is a VF sample..
<apex:page>
<apex:pageMessage id="ap" summary="A sample message" severity="INFO" strength="2" rendered="{!rendered}"  />
<apex:form >  
        <apex:commandButton value="save" status="cb"   action="{!save}" rerender="ap"/>
        <apex:actionStatus  id="cb" startText="saving..."/>
    <apex:form>
<apex:page>

My problem is that I am able to display both action status and apex page message together.

Please let me know if anyone know where and why above code is not working.

Thanks
Saurabh
AshlekhAshlekh
Hi

Message is not showing because you need to rerender parent component of message.
<apex:page>
<apex:outPutPanel id="myblock">
<apex:pageMessage id="ap" summary="A sample message" severity="INFO" strength="2" rendered="{!rendered}"  />
<apex:form >  
        <apex:commandButton value="save" status="cb"   action="{!save}" rerender="ap,myblock"/>
        <apex:actionStatus  id="cb" startText="saving..."/>
    <apex:form>
</apex:outputpanel>
<apex:page>

James LoghryJames Loghry
I don't see any controllers or anywhere where you're defining the rendered boolean and the save method, but are you setting rendered to true in a save method  in a controller somewhere?  Otherwise, your apex:pageMessage will never be rendered.  

As McGraw stated, try rerendering a parent component like "myblock" instead of "ap".  Another issue I have seen is that occasionally the rendered attribute will not work with booleans. If this is the case, also try something like rendered="{!IF(rendered,true,false)}"
Saurabh AgrahariSaurabh Agrahari
Thanks James and McGraw,


Implemented the solution as suggested by both of you and its working now.



Thanks
Saurabh
Sunil Kumar 594Sunil Kumar 594
Hi,

I have tried using the above implementation, but still it is not working for me. I am not able to display the message block after loader stops.
Please find below the code and help to fix the issue.

<apex:outPutPanel id="myblock">
  <apex:form >
    <apex:pageBlock id="pageblock">
      <apex:pageMessages id="msgblock" />
      <apex:pageBlockButtons >
        <apex:commandButton action="{!save}" value="{!$Label.Button_Save}" reRender="myblock,pageblock,msgblock" status="waitStatus" styleClass="saveButton" />
      </apex:pageBlockButtons>
    </apex:pageBlock>
    <apex:actionStatus id="waitStatus">     
        <apex:facet name="start">
            <div class="loader-section">
               <div class="pt-progressbar-circular"></div>
           </div>
        </apex:facet>  
    </apex:actionStatus>
  </apex:form>
  </apex:outputpanel>