+ Start a Discussion
meyerdmeyerd 

Validation rule message not shown on Visual Force page.

Validation rule message not shown on Visual Force page.

For example I created a validation rule on opportunity

LEN(Name) > 10

I have the following VF page.

Code:
<apex:page StandardController="opportunity" tabstyle="opportunity">
<apex:form>
        <apex:inputField value="{!Opportunity.Name}"/>
        <br/>
        <apex:inputField value="{!Opportunity.CloseDate}"/>
        <br/>
        <apex:inputField value="{!Opportunity.StageName}"/>
        <br/>
        <apex:commandButton action="{!save}" value="Save"/>
        <apex:commandButton action="{!cancel}" value="Cancel"/>
</apex:form>
</apex:page>

 
This is the behavior

I edit/create an opportunity with a name < 10 chars and the oppty save works.
I edit/create an opportunity with a name > 10 chars and the oppty does not save and I see the validation rule message.

I override edit for Opportunity with this vf page.
If I edit an opportunity and use the vf page with name < 10, save works fine.
If I edit an opportunity using the vf page and put in a name > 10 chars, it does not save but also does not show the Validation rule error message.

What do I need to do to get the validation rule message to show?






dchasmandchasman
apex:inputField should handle this automatically - I'll open a bug to track this and someone on my team will look into it. As a temporary work around try putting a in your markup after and see if the validation messages are displayed (one caveat is that they will not be displayed next to the field)