Jul 25, 2020, 7:27 PM
[CLOSED] How to prevent quotes in NumberField
Hello,
I want to prevent single- and double-quotes in NumberField input, but don't know how.
This is my code:
How to avoid that behaviour and completely prevent quotes appearing in NumberField?
Thank you
I want to prevent single- and double-quotes in NumberField input, but don't know how.
This is my code:
<%@ Page Language="C#" %>
<%@ Register assembly="Ext.Net" namespace="Ext.Net" tagprefix="ext" %>
<!DOCTYPE html>
<script runat="server">
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<script type="text/javascript">
var validateNum = function (field, e) {
if (event.keyCode == 16 || event.keyCode == 222) {
e.stopEvent();
}
}
</script>
<form id="form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<div>
<ext:NumberField ID="qty" runat="server" AllowBlank="false" FieldLabel="Qty" AllowNegative="false" AllowDecimals="false"
Width="261" MaxLength="6" MinLength="1" MinValue="1" EnableKeyEvents="true">
<Listeners>
<KeyDown Fn="validateNum" />
</Listeners>
</ext:NumberField>
</div>
</form>
</body>
</html>
I use an English keyboard with International distribution. So, when I press the quote key, nothing appears, but if I press a number key, the quote appears followed by the number pressed. Same happens with double-quote key.How to avoid that behaviour and completely prevent quotes appearing in NumberField?
Thank you