如何设置NumberTextBox只接受dojo中的数字?
发布时间:2020-12-16 21:19:20 所属栏目:百科 来源:网络整理
导读:我有以下NumberTextBox,我想只允许数字,但我不知道什么是用于使其成为可能的约束属性. input type="text" data-dojo-type="dijit.form.NumberTextBox" invalidMessage="Please enter only numbers" constraints="{}" required="true" 解决方法 你可以有以下
我有以下NumberTextBox,我想只允许数字,但我不知道什么是用于使其成为可能的约束属性.
<input type="text" data-dojo-type="dijit.form.NumberTextBox" invalidMessage="Please enter only numbers" constraints="{}" required="true" 解决方法
你可以有以下例子:
constraints: { min:0,places:0} 另见:http://www.unicode.org/reports/tr35/#Number_Format_Patterns 使用dojo NumberTextBox,您仍然可以输入字符:a,b,c.它只会给你无效的消息.如果您只想允许数字输入,可以使用javascript here. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |