On my SharePoint online site I have a custom list with a Number field.I want to apply validation on this field so that the Number should not be less than or greater than 5 digits and it should be without commas and any wild characters.


4 Answers 4


You can use input mask on that number field.

Below is the script:

<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">
   $("input[title='Phone']").mask("(999) 999-9999? Ext.99999");

For your requirement, you can replace with below line:


Here is similar thread: Column validation for US phone number format

Reference: Input mask on textbox


Expanding on @Naveen's answer, for making the user only enter 5 digits you can enter this formula in column validation: =AND(Column>10000,Column<99999). You can then enter a custom message for that. Replace Column with your column name. As for the 2nd part of your question, since it's a number field it won't let you enter commas or wildcard entries.


You don't need to put any validations formula just define the lowest i.e 10000 and highest 99999 number. It will automatically restrict the special character in the field.


  • I want to limit user to type only five digits for a better usability experience.
    – Jenny
    Aug 7, 2015 at 8:42
  • You wish to add only five digits in the field and without prompting status message as in case input is greater than 5 digit it should be trimmed to 5 right? Aug 7, 2015 at 9:05
  • Yes that's exactly what i needed. Is there any solution without programming? I am not very good in programming.
    – Jenny
    Aug 10, 2015 at 6:57

Go to "List Settings". Click on your Number field. Under "Additional Column Settings" specify the minimum and maximum values as 10000 and 99999 respectively.

enter image description here

With respect to comma, SharePoint puts a comma where appropriate. So a number 43000 would be displayed as 43,000. As for wildcard characters as it is a Number field it won't allow them to be save to List.

  • I want to limit user to type only five digits for a better usability experience. The user should be able to type only 5 digits at first place instead of having this weird message while saving the item (The value of this field must be between 10,000.00000 and 99,999.00000.)
    – Jenny
    Aug 7, 2015 at 8:51
  • @Jenny: For "user should be able to type only 5 digits", you will have to look into JSLink. In SharePoint Online, in SharePoint Admin Center you need to enable "Custom Script" options to "Allow" for JSLink to be activated. Or you can do custom development using Visual Studio. Regarding the error message The value of this field must be between 10,000.00000 and 99,999.00000., you can trim those extra decimals by setting the "Number of decimal places" to '0' as shown in my answer's screenshot.
    – Naveen
    Aug 7, 2015 at 9:14
  • @Jenny: Also, even if you set the maxlength for Number field to 5 (either using JSLink/Visual Studio), there's nothing to stop user's from entering values less than 5 characters in the field. So they would still receive the error The value of this field must be between 10,000.00000 and 99,999.00000. :)
    – Naveen
    Aug 7, 2015 at 9:17

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.