You need to sign in to do that
Don't have an account?
pjcoco
Check for Error Messages in Visualforce Page
Dear Developers,
Is it possible to check if the page has error messages? So I can stop rendering part of the page when it has error messages?
Thanks in advance.
You could use a custom controller or extension method that returns the value of ApexPages.hasMessages() , then use it in a rendered=... attribute to supress rendering.
All Answers
You could use a custom controller or extension method that returns the value of ApexPages.hasMessages() , then use it in a rendered=... attribute to supress rendering.
<apex:form>
<apex:pageblocktitle="New recruit"/>
<apex:pageblocksectioncolumn="1">
<apex:pageBlockSectionItem>
<apex:outputlabel value="First name"/>
<apex:inputtext/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem>
<apex:outputLabel value="lastname"/>
<apex:inputText />
<apex:pageBlockSectionItem/>
<apex:pageBlockSectionItem>
<apex:outputLabel value="Salary"/>
<apex:inputtext/>
<apex:pageBlockSectionItem>
<apex:pageBlockSectionItem/>
<apex:outputlabel value="Experience"/>
<apex:inputtext/>
<apex:pageBlockSectionItem/>
<apex:pageblocksection/>
<apex:form/>
<apex:page/>