everyone.
I had problem showing errors in my page, and I boiled it down to the use of showHeader="false".
Here's my Controller:
public class MyTest1 {
public MyTest1()
{
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,'See Error'));
}
}
and VF page:
<apex:page controller="MyTest1" showHeader="false" cache="false">
<h1>Hello</h1>
<apex:pageMessages rendered="true" />
</apex:page>
The error message will only be displayed if I removed the showHeader="false"
I read the documentation and didn't find they are related. I need to customize my page and do not want to use the standard header.
Any suggestion would be appreciated.
Best Answer
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.
The controller:
The class: