Switch to full style
ASP/ASP.net examples
Post a reply

validation on number

Sun Apr 03, 2011 10:09 pm

Following is an example on how to validate an number
Code:
<!--  form to enter a number to be validated  . -->
<
form method="get" action ="<%= Request.ServerVariables("SCRIPT_NAME") %>" > 
<input type ="text" name="number"><br> 
<input type="submit"> 
</form> 
<% 
Dim strNumber 
, intNumber , blnFlag 
If Request
.ServerVariables("CONTENT_LENGTH") <> 0 Then 
strNumber 
= Trim(Request.form("number")) 
' check if strNumber is a number.
If isNumeric(strNumber ) Then 
'
 convert from string to integer.
intNumber = CInt(strNumber ) 
' if number less than 10 then success 
If 10 >= intNumber Then 
blnFlag = True 
End If 
'
if a number is entered then display this 
Else 
Response
.Write "not  valid number<br>" 
End If 
'number is entered ok .
'
check the value of boolean 
If blnFlag 
= True Then 
Response
.Write("Number = " & intNumber ) 
 print message for invalid number
.
Else 
Response
.Write("Enter an number less than 10 ") 
End If 
End If 
%>
 




Post a reply
  Related Posts  to : validation on number
 convert integer number to octal,hexadecimal number systems     -  
 convert octal number to decimal number     -  
 convert decimal number to octal number     -  
 XML validation against DTD     -  
 DNS Validation     -  
 validation using JavaScript     -  
 date validation in asp     -  
 Validation using Ajax     -  
 US Zip Code Validation     -  
 What will be validation for Zip code ?     -  

Topic Tags

ASP Validation