Jul 03, 2012, 2:14 PM
[CLOSED] Trying to remove character for TextField in Javascript on KeyPress.
Since the Masking is not available right now, I'm trying to remove the non-numeric character for Time.
Need to remove when Non-Numeric !!
If you have a different approach, please advice ?
Need to remove when Non-Numeric !!
If you have a different approach, please advice ?
<%@ Page Language="C#" %>
<%@ Register Assembly="Ext.Net" TagPrefix="ext" Namespace="Ext.Net" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Example of Issue </title>
<script type="text/javascript">
var isNumberKey = function() {
var key = event.keyCode;
if (key >= 48 && key <= 57) {
alert("Numeric");
return true;
}
alert("Non-Numeric");
return false;
}
</script>
</head>
<body>
<form id="Form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<asp:ScriptManager runat="server" />
<br />
<ext:TextField ID="TextField1" runat="server" Width="45" AllowBlank="false" Text="00:00"
EnableKeyEvents="true" MaxLength="5">
<Listeners>
<KeyPress Fn="isNumberKey" />
</Listeners>
</ext:TextField>
</form>
</body>
</html>
Last edited by Daniil; Jul 04, 2012 at 11:02 AM.
Reason: [CLOSED]