You need to sign in to do that
Don't have an account?
johnc82
VF Page Field Level Validation
Am I doing this correctly? It works, just want to know if there are better ways of doing it.
<apex:pageBlockSection id="pageblock1" title="PageBlock" columns="2" rendered="{!object.field__c==true}"> <apex:pageBlockSectionItem id="id1" helpText="{!$ObjectType.object__c.Fields.field__c.inlineHelpText}"> <apex:outputLabel value="This is a long field label" for="field1" /> <apex:inputField id="field1" value="{!object.field1__c}" > <apex:actionSupport event="onchange" action="{!saveobject}" rerender="pageblock1" /> <!-- Start Error outputPanels --> <!-- Check for Null --> <apex:outputPanel rendered="{!object.field1__c != 'Yes' && object.field1__c != 'No'}"> <div class="errorMsg"><strong>Error:</strong> You have to select a value.</div> </apex:outputPanel> <!-- Other Criteria--> <apex:outputPanel rendered="{!object.field1__c == 'No'}"> <div class="errorMsg"><strong>Error:</strong> Requires "Yes" to generate Proposal</div> </apex:outputPanel> <!--End Error outputPanels --> </apex:inputField> </apex:pageBlockSectionItem> </apex:pageBlockSection>
Bob's blog has very good posts fro field level security
http://bobbuzzard.blogspot.com/2011/04/field-level-error-messages-with.html
http://bobbuzzard.blogspot.com/2011/04/field-level-error-messages-with_29.html
If a reply to a post answers your question or resolves your problem, please mark it as the solution to the post so that others may benefit.