You need to sign in to do that
Don't have an account?
how to display Validation Rule error message in visual force page
hi
I have crated a object called project , it contains project name , start date and end date . I need to validate end date must be grater than start date . For this i write validatation rule
Error Condition Formula
Project_Start__c > Project_End__c
It works well when i open in separate tab . But in main page, i entered all details include strat and end date , then save the details it needs to show error message. But i dont get any error message and the page closed. The value not showed in obeject(works correctly) . but i need to show the error message and the page need not to be closed automatically. how to chive this .Thanks
oncomplete means as soon as the request has completed, not when it is successful.
You'll need to set a value in the controller and then render some javascript conditionally that closes the window if the record saved correctly.
While its not an exact match for your requirements, the following blog post contains an example of taking some action after a record has saved:
http://bobbuzzard.blogspot.co.uk/2011/05/refreshing-record-detail-from-embedded.html
All Answers
I wouldn't expect the page to close. If you have a pagemessages component on the page, that should display the error message.
HI
I am in need to close the page when save button click if it has correct value so i write
<apex:commandButton id="save-btn" styleclass="save-btn" action="{!saveNewProject}" value="Save" onComplete="closePage();"/>
in Closepage javascript i close the page using javascript. if i remove onComplete="closePage(); . then it works fine.
I need both operation .
1. when correct value enters it need to save and automatically close
2. If wrong value it need to show the error and need not to be closed .
How to achieve this
oncomplete means as soon as the request has completed, not when it is successful.
You'll need to set a value in the controller and then render some javascript conditionally that closes the window if the record saved correctly.
While its not an exact match for your requirements, the following blog post contains an example of taking some action after a record has saved:
http://bobbuzzard.blogspot.co.uk/2011/05/refreshing-record-detail-from-embedded.html