Groups | Blog | Home
all groups > dotnet jscript > december 2003 >

dotnet jscript : Validate TextBox input as Int32



Pratik Parikh
12/17/2003 10:56:05 AM
Hi everyone,

I was wondering if anone have any idea of how about validateing the
TextBox input is Int32 or not. I want to validate character-by-character.
Please let me know.

here is what i have:
public static function inputQuantityValidater(inputQuantity :
String):String{

var taObj=(event.srcElement)?event.srcElement:'undefined';

if(taObj.value){

}

}

Pratik Parikh
12/17/2003 1:31:22 PM
Hi Everyone,

I have a problem, the control is auto postback. So it overwrites the screen,
how do I deal with that seniro....Please let me know if you think of
anything, to deal with that. I tried disabling EnableViewState to false. And
it is same with the setting to.

Thank You
[quoted text, click to view]

Pratik Parikh
12/17/2003 2:06:54 PM
TextBox control is autopost.

Thank You
[quoted text, click to view]

Martin Honnen
12/17/2003 5:51:20 PM


[quoted text, click to view]

There is an ASP.NET validation control to perform that check:

<%@ Page Language="JScript" %>
<html>
<head>
<title>Using a CompareValidator to check for a certain type</title>
</head>
<body>
<form runat="server">
<p>
<asp:TextBox id="Input0" runat="server" />
<asp:CompareValidator id="CompTypeInt0"
ControlToValidate="Input0"
Type="Integer"
Operator="DataTypeCheck"
ErrorMessage="Please enter an integer value."
runat="server" />
<input type="submit" id="SubmitButton">
</p>
</form>
</body>
</html>

--

Martin Honnen
http://JavaScript.FAQTs.com/
Martin Honnen
12/17/2003 7:36:03 PM


[quoted text, click to view]

Which control?

[quoted text, click to view]

--

Martin Honnen
http://JavaScript.FAQTs.com/
Martin Honnen
12/19/2003 6:17:19 PM


[quoted text, click to view]

If you don't want that you should be able to set
<asp:TextBox
AutoPostBack="False"

--

Martin Honnen
http://JavaScript.FAQTs.com/
AddThis Social Bookmark Button