I have to restrict user from entering/selecting date less than current date

  • 1
  • Question
  • Updated 4 years ago
Date field automatically takes some random year value while entering date value manually.For example: while entering date as 18/03 /2 after typing 2 in year it takes some random year as 2002.
Photo of Amritesh

Amritesh

  • 80 Points 75 badge 2x thumb

Posted 4 years ago

  • 1
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
The most straight forward means of doing this will be by adding validation rules on the field in salesforce.  Of course that is a server side solution and will not prevent users from seeing the old date.  

Our date picker uses the JQueryUI DatePicker,  which has a substantial number of customization possibilities.  You can create a custom renderer that leverages the "minDate" function of the date picker.  See more documentation here
Photo of Amritesh

Amritesh

  • 80 Points 75 badge 2x thumb
Thank you Rob, that works.
one more question, I want to restrict manual entry like typing a date value in the date field. how to restrict that here ?.
 In jquery I used to make input field readonly thats works for that,but here making field readonly from standard functionality doesn't serve my purpose.