You need to sign in to do that
Don't have an account?
Shiva
How to use validation rule?
I have created VF page by extending the standard object. And I have created a validation rule for a field in the object. But it is not working may be because of custom page. Please can someone tell me how to invoke the rule in custom page?
Thanks in advance.
Use following tag in your custom visual force page......
<font color="red"><apex:messages styleClass="error" /> </font>
It will show your validation rule error message.
A few more tips:
1) Make sure you use <apex:inputField value="{!object.field}" /> notation. This "binds" the value to the object's field, which will in turn force field validation such as requiredness and custom validations.
2) Make sure the field appears on the page, or strange things can happen (usually, validation won't run at all for the field, but more often an unresolvable error will pop up).
3) Make sure you are calling "{!save}", "{!update}", etc in order to invoke a DML that will validate the page; re-rendering the page also usually works to trigger validations (this is sometimes unfortunate, actually).
A "messages" block is not necessary except for page-level exceptions (validation rules that target "top of page" instead of a field). Your error should be displayed on the field(s) which fail validation.