You need to sign in to do that
Don't have an account?
cloud machine
Client should not be able to select future date
I have a VF page which has a date field, i have a validation on it but its working in a standard way but its not working in VF page with class even after using page messages functionality.
Validation Rule is object based. It has nothing to do with standard or custom page.
Can you share what is the validation rule which is not working in your page?
Thanks
Date__c > Today()
The above is working normally and if i use same field in visual force page then its not working
ya i used
The Validation is working but its not displaying error msg even after using page messages
STRANGE !!
If that is the case you can do a workaround, you can add that condition in your custom controller and use addError method of salesforce
if(obj.Date__c > System.Today()) {
obj.Date__c.addError('Your Error Message');
}
If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.
Thanks
Hi,
Have you used try and catch for the function. If you are missing try and catch, the validation will not show , even you are using apex:pagemessages.
Do you have the immediate attribute set to true?
Hi,
Eventhough you set up <ape:pagemessages/> in your page, it wont display the error because you might have some conditions changed to the function 'Save()' or 'Edit()'.
So, you must use exception handling to solve this type of issues. I too got stucked in the same problem before. So only i can be sure about it.
Anyways, try using the following eg,
public class egController{
pulbic void save(){
try{
//implement your logic here
}
catch(Exception e){
ApexPages.addMessages(e);
}
}
}
Hope this will help you...!