function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Linda 98Linda 98 

Display error or alert on Vf page

Hi.II have a search VF page with various field datatypes.
Like Date,currency.

I would like to display error on Vf page when date format is not being followed.Default format is yyyy-dd-mm.So if user enters other than this format,i want to show an alert or error on Vf page saying to enter correct format.


Please help.
UrvikUrvik
create a validation rule for your date field..and put this </apex:messages> in your visualforce page...so when a format is not followed- an error message is displayed..
Pravi_1133Pravi_1133
date.valueof(String), this function takes argument only in yyyy-dd-mm format. 

if user enters anything different it throws excepton, you can catch these exceptions using <apex:pagemessages>, <apex:messages> componenets.
hope this solves your problem. if you get any better solution, pls share it across.


--Pravi
Linda 98Linda 98
I would like to show some instructions as a pop up or some other way when user clicks on that field to enter data for searching..any ideas please