You need to sign in to do that
Don't have an account?
Melissa Mueller 9
I am seeing the Visualforce page message in my debug logs but cannot get it to display on the page!
I have asked this question on salesforce.stackexchange.com approximately 10 days ago. I received some feedback and edited my code. I still can't get error messages to display and controller no longer calls my apex code! Could someone, anyone, look over the updated code and see if you can tell why this is happeninig or how I can fix it? I would really appreciate the help! The question is here: https://salesforce.stackexchange.com/questions/192422/i-am-seeing-the-visualforce-page-message-in-my-debug-logs-but-cannot-get-it-to-d
I noticed immediately that in your code: <apex:page standardController="Case" extensions="CaseControllerExt" Title="New Warranty Claim" showHeader="false" id="createNewWarranty" docType="html-5.0">
<Apex:pageMessages/> not working if showHeader=“false”
"For some reason, messages created inside the constructor are not displayed when the page header isn't shown. If you move that to a method and add it to your actions, it will work. Also, you need to load the standard style sheets since they are usually included with the header. If you don't it looks ugly." Daniel Hoechst
https://salesforce.stackexchange.com/questions/15167/apexpagemessages-not-working-if-showheader-false
If your code has been updated (without showHeader="false" now), please post the complete current code here.
public with sharing class CaseControllerExt {
public CaseControllerExt(ApexPages.StandardController controller){ // ... and that is your constructor.
Regards
First, let me thank you for taking the time to respond. I have read your post and the referenced question with solution from someone else, but I am confused. The code in that example is so basic I am not sure how to relate it to my code. To start, I took the code that you have seen and changed showHeader to true. (The header looks just fine without doing anything else and I don't really care if it's there or not.) That let my code call the apex again, but as expected, since I have no units listed as faulty, a debug log apex error is thrown after it passes the if statement that should throw a visible error message and escape out of the code. That if statement seems to be passed right over and instead the code continues and dies when it executes the next statement that should only be executed if that error isn't thrown. No error message that is visible to the user is displayed, however, I can see it in the debug log. Ugh...
If I move the error calls to their own method, I am guessing that I should be calling them from their respective catch or if statements. That would mean that each different message I want to display would need its own method.... Am I on the right track? If so, do I call from the Apex class and have all the error message methods on the controller or should they reside elsewhere?
It is will be difficult to reproduce your problem.