+ Start a Discussion

Validation Rules

Will the validations rule work in vf page what ever we have kept in object.




Yes Validation rule work on VF page.


Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 


K i am getting validation error like ths after clicking submit button.


Visualforce Error

System.DmlException: Upsert failed. First exception on row 0 with id a0090000002qLz4AAE; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Start Date must be less than End Date: [StartDate__c]
Class.input1.save: line 36, column 1


i want error messages near the field in vf page what i have to do for dat.

Anup JadhavAnup Jadhav

If the field is an <apex:inputField> component and is bound to the controller object field, then it really depends on validation configuration. If you have set it to be displayed near the field, it will display it near the field.


If a user enters data on a Visualforce page that uses a standard controller, and that data causes a validation rule error, the error can be displayed on the Visualforcepage. If the validation rule error location is a field associated with an <apex:inputField> component, the error displays there. If the validation rule error location is set to the top of the page, use the <apex:pageMessages> or <apex:messages> component within the <apex:page> to display the error.




i have give erroro msg in validation rule in object near the field only but it not showing near the field after clicking submit its showing in seperately like above i shown.