2

I have a list in SharePoint 2013 and i want to add date mask to specific text box on the new form "dd\mm\yyyy"

how can i make masked textbox for date

thanks

1
  • Read about client side rendering (CSR) and regular expressions, you might also find a similar problem solved in other's questions here May 20, 2017 at 6:49

3 Answers 3

4

You can use below script for input mask on textbox:

<script language="javascript" src="http://code.jquery.com/jquery-1.4.2.min.js" type="text/javascript" ></script>
<script language="javascript" src="http://jquery-joshbush.googlecode.com/files/jquery.maskedinput-1.2.2.min.js" type="text/javascript" ></script>
<script language="javascript" type="text/javascript">
jQuery(function($){
   $("input[title='FieldName']").mask("99\99\9999");
});
</script>

I have not tested this, but it should work.

Here is the link for more reference. Column validation for US phone number format

0
3

You can use JSLink to achieve the functionality.

There are four to five function you can write by overriding to achieve that.

‘View’ function to render the field if it is included in a list view. In this function you return html.

‘DisplayForm’ function to render the field when the user is viewing the properties of a list item. Also returns html.

‘EditForm’ function to render the field when the user is editing the properties of a list item. Returns html.

‘NewForm’ function to render the field when the user is adding a new list item. Again, should return html. Normally this would be the same as the ‘EditForm’ but it doesn’t have to be.

‘GetValueCallBack’ function to pass the field’s value to SharePoint after the user clicks Submit. This one should return the value type of the field type. In my example, I’ll return a string value.

Details are described in this article.

0

standard SharePoint Field Validation rules are SharePoint (Calculated) Formulas

So you could check for (something like)

  • =TEXT( [field] , "dd\mm\yyyy" )

All available functions: http://www.viewmaster365.com/365coach/#/Calculated_Column_Functions_List

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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