admin管理员组文章数量:1022964
I need to make a numeric field only integer, so that the field does not accept decimals. I would not even like the field to approximate, simply not accepting points or mas.
Based on the culture, it accepts the numeric separator (eg EN is the point, IT is the ma)
Here is the code I tried
$("#numerictextbox").kendoNumericTextBox({
culture: "en-US",
step: 500,
spinners: false,
format: "#",
decimals: 0
});
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Kendo UI Snippet</title>
<link rel="stylesheet" href=".3.1023/styles/kendomon.min.css"/>
<link rel="stylesheet" href=".3.1023/styles/kendo.rtl.min.css"/>
<link rel="stylesheet" href=".3.1023/styles/kendo.silver.min.css"/>
<link rel="stylesheet" href=".3.1023/styles/kendo.mobile.all.min.css"/>
<script src=".12.4.min.js"></script>
<script src=".3.1023/js/kendo.all.min.js"></script>
<script src=".3.1023/js/cultures/kendo.culture.en-US.min.js?bust=v21"></script>
</head>
<body>
<input id="numerictextbox" />
</body>
</html>
I need to make a numeric field only integer, so that the field does not accept decimals. I would not even like the field to approximate, simply not accepting points or mas.
Based on the culture, it accepts the numeric separator (eg EN is the point, IT is the ma)
Here is the code I tried
$("#numerictextbox").kendoNumericTextBox({
culture: "en-US",
step: 500,
spinners: false,
format: "#",
decimals: 0
});
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Kendo UI Snippet</title>
<link rel="stylesheet" href="https://kendo.cdn.telerik./2019.3.1023/styles/kendo.mon.min.css"/>
<link rel="stylesheet" href="https://kendo.cdn.telerik./2019.3.1023/styles/kendo.rtl.min.css"/>
<link rel="stylesheet" href="https://kendo.cdn.telerik./2019.3.1023/styles/kendo.silver.min.css"/>
<link rel="stylesheet" href="https://kendo.cdn.telerik./2019.3.1023/styles/kendo.mobile.all.min.css"/>
<script src="https://code.jquery./jquery-1.12.4.min.js"></script>
<script src="https://kendo.cdn.telerik./2019.3.1023/js/kendo.all.min.js"></script>
<script src="https://kendo.cdn.telerik./2019.3.1023/js/cultures/kendo.culture.en-US.min.js?bust=v21"></script>
</head>
<body>
<input id="numerictextbox" />
</body>
</html>
Here you can find the link to dojo with the example of Italian culture, in this case it blocks the ma
Share Improve this question edited Oct 28, 2019 at 10:28 i.signori asked Oct 28, 2019 at 10:11 i.signorii.signori 5953 silver badges16 bronze badges 3- 1 Have you tried changing the format to "{0:n0}"? You can also try "{0:#.##}" if you find that "{0:n0}" doesn't always get rid of the decimal separator. – Daniel Attfield Commented Oct 28, 2019 at 10:23
- They eliminate the decimal separator, but the problem remains. I would not like the new value to be approximated (eg 3.9 bees 4) – i.signori Commented Oct 28, 2019 at 10:32
- I wouldn't want them to be able to add it, now as you can try in the examples, it's possible. But I would like to have only integer number, if possible not let the user to insert a separator. – i.signori Commented Oct 28, 2019 at 10:41
1 Answer
Reset to default 6Try using the restrictDecimals configuration option.
$("#numerictextbox").kendoNumericTextBox({
culture: "en-US",
step: 500,
spinners: false,
format: "#",
decimals: 0,
restrictDecimals: true
});
With this configuration a ma and a point with behave like entering a letter(red exclamation flash).
Example
I need to make a numeric field only integer, so that the field does not accept decimals. I would not even like the field to approximate, simply not accepting points or mas.
Based on the culture, it accepts the numeric separator (eg EN is the point, IT is the ma)
Here is the code I tried
$("#numerictextbox").kendoNumericTextBox({
culture: "en-US",
step: 500,
spinners: false,
format: "#",
decimals: 0
});
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Kendo UI Snippet</title>
<link rel="stylesheet" href=".3.1023/styles/kendomon.min.css"/>
<link rel="stylesheet" href=".3.1023/styles/kendo.rtl.min.css"/>
<link rel="stylesheet" href=".3.1023/styles/kendo.silver.min.css"/>
<link rel="stylesheet" href=".3.1023/styles/kendo.mobile.all.min.css"/>
<script src=".12.4.min.js"></script>
<script src=".3.1023/js/kendo.all.min.js"></script>
<script src=".3.1023/js/cultures/kendo.culture.en-US.min.js?bust=v21"></script>
</head>
<body>
<input id="numerictextbox" />
</body>
</html>
I need to make a numeric field only integer, so that the field does not accept decimals. I would not even like the field to approximate, simply not accepting points or mas.
Based on the culture, it accepts the numeric separator (eg EN is the point, IT is the ma)
Here is the code I tried
$("#numerictextbox").kendoNumericTextBox({
culture: "en-US",
step: 500,
spinners: false,
format: "#",
decimals: 0
});
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Kendo UI Snippet</title>
<link rel="stylesheet" href="https://kendo.cdn.telerik./2019.3.1023/styles/kendo.mon.min.css"/>
<link rel="stylesheet" href="https://kendo.cdn.telerik./2019.3.1023/styles/kendo.rtl.min.css"/>
<link rel="stylesheet" href="https://kendo.cdn.telerik./2019.3.1023/styles/kendo.silver.min.css"/>
<link rel="stylesheet" href="https://kendo.cdn.telerik./2019.3.1023/styles/kendo.mobile.all.min.css"/>
<script src="https://code.jquery./jquery-1.12.4.min.js"></script>
<script src="https://kendo.cdn.telerik./2019.3.1023/js/kendo.all.min.js"></script>
<script src="https://kendo.cdn.telerik./2019.3.1023/js/cultures/kendo.culture.en-US.min.js?bust=v21"></script>
</head>
<body>
<input id="numerictextbox" />
</body>
</html>
Here you can find the link to dojo with the example of Italian culture, in this case it blocks the ma
Share Improve this question edited Oct 28, 2019 at 10:28 i.signori asked Oct 28, 2019 at 10:11 i.signorii.signori 5953 silver badges16 bronze badges 3- 1 Have you tried changing the format to "{0:n0}"? You can also try "{0:#.##}" if you find that "{0:n0}" doesn't always get rid of the decimal separator. – Daniel Attfield Commented Oct 28, 2019 at 10:23
- They eliminate the decimal separator, but the problem remains. I would not like the new value to be approximated (eg 3.9 bees 4) – i.signori Commented Oct 28, 2019 at 10:32
- I wouldn't want them to be able to add it, now as you can try in the examples, it's possible. But I would like to have only integer number, if possible not let the user to insert a separator. – i.signori Commented Oct 28, 2019 at 10:41
1 Answer
Reset to default 6Try using the restrictDecimals configuration option.
$("#numerictextbox").kendoNumericTextBox({
culture: "en-US",
step: 500,
spinners: false,
format: "#",
decimals: 0,
restrictDecimals: true
});
With this configuration a ma and a point with behave like entering a letter(red exclamation flash).
Example
本文标签: javascriptHow to disable dots on Kendo UI NumericTextBoxStack Overflow
版权声明:本文标题:javascript - How to disable dots on Kendo UI NumericTextBox? - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745593925a2158048.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论