Prevent user from entering white space during form input in asp.net model validation?

后端 未结 3 508
执念已碎
执念已碎 2021-01-13 10:43

I have bee using model validation in asp.net MVC website. I want to have a functionality to prevent user from entering whitespace in testbox and submit the form.

The

3条回答
  •  鱼传尺愫
    2021-01-13 11:17

    This regular expression might work

    ^[a-zA-Z0-9,-.@~!#$%&*<>?:;_='/()]+(\\s+[a-zA-Z0-9,-.@~!#$%&*<>?:;_='/()]+)*$
    

提交回复
热议问题