Skip to main content

Posts

Showing posts from February, 2014

Restrict Future or Past Date in List

Many a times you will come across a requirement wherein you need to restrict user from entering future or past date in a List or Document Library Date column.

Developers are inclined towards writing either event handler or javascript to achieve this. But, hold on! You can achieve this without writing a single line of code.

I have a list which stores Employee details like Employee Number, Name and Date of Joining.


Here I need to enure that Date of Joining will not accept future date. Navigate to List Settings -> Validation Settings. Here you can enter the formula to restrict future date as shown below. If you change the logical operator, it will restrict past date. Also, you can put message which will be displayed to user.


Now, when you try to enter future date and try Save, you will see the validation message.

So, next time you have similar requirement, you know where to try first before jumping into coding!