You need to sign in to do that
Don't have an account?
Wizrad
Send ApexPages.message to specific <apex:pageMessages>
Hi all,
Let's say I had a simple page...something along the lines of the following...
<apex:page controller="SomeController"> <apex:pageMessages id="error1" /> <apex:pageMessages id="error2" /> </apex:page
Now lets say somewhere in this "SomeController" class I am adding a message to the page.
... ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.INFO, 'My message here.')); ...
I don't want this message to go to both pageMessages, I only want it to go to 1.
I could swear the DEV 501 videos say that you can do this by doing something similar to the following:
... ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.INFO, 'My message here.'), 'error1'); ...
Yet the documentation says nothing about this. I'm not really in the mood to watch more of Chris Barry to find where he says this. Anyone know how to accomplish this?
Thanks!
I recommend you make use of rendered attribute on the tag.
Declare a Boolean variable and use it in the above attribute of apex:pagemessages tag.
public Boolean renderError {get;set;}
<apex:pageMessages id="error1" rendered="{!renderError}"/>
<apex:pageMessages id="error2" rendered="{!NOT(renderError)}"/>