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!
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!
please can you show me how to restrict date not to exceed November 2016
ReplyDeleteHere is an example:
ReplyDelete=[DateColumn]<DATEVALUE("11/01/2016")
Hi , can you please show me =<=Today and =>=Today in wss 3.0
ReplyDeleteBhuvanendran, what exactly is your question? Can you explain what exactly your requirement is?
DeleteSuresh, Actually I have created one custom list in wss 3.0 for daily call log report. Here Reporting and closing time there are two field is there.
ReplyDeleteReporting Time <= Today () and Closing Time >=Today () should be like this and I have applied a formula with this two column as Total time taken =TEXT ([Closing Time]-[Reporting Time],"h: mm") (This formula is working correctly)
Now the default option is we can select any date but thing is If we select future reporting date, error should come and if we select
For example:
Reporting Date & time should be today or past date is 18/1/2016 or 17/1/2016 and closing time is 18/1/2016 or greater (19/1/2016 ) and it should not be past date .
This is my exact requirement. Can you suggest how to do in wss 3.0
Try this formula:
ReplyDelete=IF([Reporting Time]<=TODAY(),IF([Closing Time]>=TODAY(),TRUE,FALSE),FALSE)
Suresh,I have tried this one but it's not taken and the error shows like syntax error or not support . for example i tried = Today is working but = Today() is not workling and i have checked with <, > symbol also not support i tried like <=Today ,>= Today . Is any other way to do it in wss 3.0 . Please
ReplyDeleteA couple of things:
Delete1. I tried this formula myself before posting and it worked. You need to use this formula under List Validation (as explained in this blog post), and not Column Validation.
2. I tried this formula in SP2013 and not in WSS 3.0.
Can you confirm you tried as mentioned in point 1?
No actually in wss3.0 there is no validation settings while creating the column there is an option like calculate value .Here only i tried . Let me know Is there any formula syntax is different for wss3.0 .
DeleteOk, I don't remember WSS 3.0. If you even had column validation, you could have tried these formula under respective columns:
Delete=[Reporting Time]<=TODAY()
=[Closing Time]>=TODAY()
Calculate value is to derive default date based on a calculation. As far as I know, it cannot be used for validation.
Can you advise how to tweak the formula for local time zone. I am in Eastern, but site is set up for Pacific. It is after midnight here and I tried to enter 7/30/19, but since that is a future date from the perspective of the Site zone of Pacific I got the error message I created to not allow future dates.
ReplyDelete@Judy, I know I'm replying very late, sorry for that. Handling time zone in SharePoint is really a difficult task. It is due to the fact that SharePoint stores date in UTC format in database and converts date and time as per the regional setting.
DeleteAs far as I know, without writing a complex code, there is no way to handle within a calculated column or formula.