You need to sign in to do that
Don't have an account?
Service cloud user
Different Apex page message for different error on same VF
Hi,
What about if we want to add different error maessage to different output panels in same page.like
<apex:outputPanel id="op1">
<apex:pageMessage/>
</apex:outputPanel>
<apex:outputPanel id="op2">
<apex:pageMessage/>
</apex:outputPanel>
<apex:outputPanel id="op3">
<apex:pageMessage/>
</apex:outputPanel>
How can i specify different message for different apex:message at the same time.??
Thanks
Kaushik
Short answer is you can't. The apex:pageMessages component displays all messages that have been added to the current page, so if you have multiple of these you will display the same messages multiple times.
I've always had to roll my own in this situation.
All Answers
Hi,
You can use rerender attribute for any action component and show the different messages in different output panel at the same time.
Please refer to the code below for clarity :-
<apex:commandbutton action="{!SendValue}" value="SendEmail" rerender="op1,op2,op3"/>
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.
hi,
I got the point , but if throwing an exception then i will directly use ApexPage.addmessgaes() function whch will add that error message to all the <Apex:PageMessage> tag i suppose.
What if on some action component i want to specify 2 different error messages in two different <apex:pagemessage> component on click of a single action component.
How can i achieve that.?
Please mention if I am not clear.
Thanks,
Kaushik
Short answer is you can't. The apex:pageMessages component displays all messages that have been added to the current page, so if you have multiple of these you will display the same messages multiple times.
I've always had to roll my own in this situation.
Hey thnx bob..
May be as a workaround i can use the output label and populate the error messages accordingly.
Thanks,
Kaushik Ray
I often end up putting them into an HTML formatted String and using apex:outputText with the escape attribute set to true.
Labels would work too though. You can create Lists of strings for the various places that errors get displayed and iterate those.