0

I have date column in SharePoint list, which is basically for a license file application. So I want that the user cannot select date unless and until he is 18+ years.

What formula do I need to apply for this ?

  • SharePoint 2010 or 2013? – Atish Dipongkor - MVP Jun 24 '16 at 6:56
  • And what have you thought of to accomplish the task so far? How do you know the age of the user: user profile property, another column specifying the date of birth, etc.? – Mihail-Florin Popa Jun 24 '16 at 8:57
0

I'm Not sure that can you achieve this using validation formulas but you can achieve this using SPUtility.js

1.Edit "Edit item" form of your list in browser.
2. Add Script editor web part.
3. Add the following script in script editor and save.

<script src="/jquery.min.js" type="text/javascript"></script>
<script src="/sputility.js" type="text/javascript"></script>

<script type="text/javascript">
$(document).ready(function () {
var ageValue= SPUtility.GetSPField('AGE').GetValue();
var dateField=SPUtility.GetSPField('DATE');
if(ageValue<18)
{
dateField.MakeReadOnly();
}
else
{
dateField.MakeEditable();
}
});
</script>

SPUtility.js is a JavaScript library used to make modifications to SharePoint's list forms (NewForm.aspx, DispForm and EditForm.aspx in a survey, custom list or library). It works with SharePoint 2007, 2010, and 2013 (including SharePoint Online / Office 365).

Look SPUtility.js documentation for more details.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.