validation to restrict users to use English keyboard

ameneh maleki 26 Reputation points
2021-02-15T10:56:34.39+00:00

I look for validation that restrict users to enter for example National Code with English Keyboard in sharepoint list, can you help me how I can set it?

SharePoint Server
SharePoint Server
A family of Microsoft on-premises document management and storage systems.
2,298 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Allen Xu_MSFT 13,806 Reputation points
    2021-02-16T05:21:20.81+00:00

    Hi @ameneh maleki ,

    As per my understanding, you don't want users to type in English characters in the fields like National Code as it should be composed of "+" and numbers. If so, you can refer to the below JS code and embed it into the new item page using the script editor web part. Please use Regular Expression in PreSaveAction method like this:
    68476-samplejs.txt

    Alert will pop out if users type English characters in my test field. And invalid items cannot be saved to the list.
    68522-image.png
    If you type valid characters in this field, it can be successfully saved to the list.
    68505-image.png
    Please feel free to let me know if i misunderstand what you mean.


    If an Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.