同一文本框上的多个蒙版 [英] Multiple Masks on same textbox

查看:102
本文介绍了同一文本框上的多个蒙版的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我有一个文本框,目前只允许7位数字。现在连同当前场景,我想允许它接受数字,字母和空格。这该怎么做?我们可以在同一个文本框上同时有多个面具吗?



另外我的第二个问题是:



如果我想在数据库中维护一个表格,其中包含文本框应接受的所有已定义格式,然后在用户在文本框中输入值时检查这些格式。可能吗?如果可能的话,最大的优点是,每次如果用户想要一些不同的格式,那么我只会更新我的后端,这反过来避免代码更改。



谢谢

Surendra

Hi All,

I have a textbox which currently allows only 7 digit number. Now along with current scenario, I want to allow it to accept digits, alphabets and spaces also. How to do this? Can we have multiple masks at the same time on same textbox?

Also my 2nd Question is:

If i want to maintain a table in the database with all the defined formats which textbox should accept and then checking those formats when user enters value in textbox. Is it possible? If possible then the biggest advantage is that, every time if user wants some different format then i will just update my back end which in turn avoids code change.

Thanks
Surendra

推荐答案

如果您有此蒙版框的源代码,则可以更改源代码以接受其他字符。

如果没有,请尽可能请求此控件的作者提供这些添加。
If you have the source code for this masked box, you can change the source code to accept additional characters.
If not, request the author of this control to provide these additions if possible.


Q1的答案:



是的,你可以。为此,你必须使用正则表达式



点击此处查看更多信息:关于正则表达式的Premier网站



Ans对于Q2:



您需要在桌面上保留字符串



因此您使用的是MVC,您可以使用上面提到的reg-exp验证您的用户输入在客户端本身。
Ans for Q1 :

Yes you can.For that you have to use Regular-Expressions

Check here for more info : The Premier website about Regular Expressions

Ans for Q2 :

You need to maintain just a string filed on your table.

Hence you're using MVC,you can validate your user inputs by using above mentioned reg-exp on client side itself.


这篇关于同一文本框上的多个蒙版的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆