TextBox Validation ( Not Allow these Characters )
-
hi, i need to restrict given characters in Text Box , how can i restrict text-box (client side validation). Please suggest me better way. Thanks & Regards, Vishnu.
-
hi, i need to restrict given characters in Text Box , how can i restrict text-box (client side validation). Please suggest me better way. Thanks & Regards, Vishnu.
vishnukamath wrote:
how can i restrict text-box (client side validation).
Given characters means ? number of char ? Are you looking for MAxLength ?
Cheers ! Abhijit Jana | MVP Web Site : abhijitjana.net | Follow Me @ twitter Visit My Blog Abhijit's World of .NET
-
vishnukamath wrote:
how can i restrict text-box (client side validation).
Given characters means ? number of char ? Are you looking for MAxLength ?
Cheers ! Abhijit Jana | MVP Web Site : abhijitjana.net | Follow Me @ twitter Visit My Blog Abhijit's World of .NET
hi, Not no of Characters and no maxlength ,characters mean (cc345,@sdrf)like the way.I need to restrict only these characters. Thanks and Regards, Vishnu.
-
hi, Not no of Characters and no maxlength ,characters mean (cc345,@sdrf)like the way.I need to restrict only these characters. Thanks and Regards, Vishnu.
I believe the way you need to handle this is to write some javascript which will validate the field before returning to your application. The basic idea is something like:
function validateMyStuff() {
// I'm using this to validate that at least one radio button has been checkedif (document.getElementById('<%=radPriceLow.ClientID%>').checked == false &&
document.getElementById('<%=radPriceMid.ClientID%>').checked == false &&
document.getElementById('<%=radPriceHigh.ClientID%>').checked == false) {
alert("You must select a price to approve.");
return false;
}
}My button on the web page is defined like this: Check the code for syntax errors, it may have gotten messed up when I did my copy & paste, but you should get the general idea. good luck :thumbsup:
-
hi, i need to restrict given characters in Text Box , how can i restrict text-box (client side validation). Please suggest me better way. Thanks & Regards, Vishnu.
this simple example will demonstate how to dis allow certain chars
<html>
<head>
<script>
restictIt = (function(){
var args = arguments;
return function(el){
for(var i=args.length;i--;){
if (el.value.indexOf(args[i]) != -1){
el.value = el.value.substring(0,el.value.length-1);
}
}
}
})('a','b','c')// put disallowed chars here
</script>
</head>
<body><input type=text onkeyup="restictIt(this)">
</body>
</html>
modified on Tuesday, September 14, 2010 12:38 PM
-
hi, i need to restrict given characters in Text Box , how can i restrict text-box (client side validation). Please suggest me better way. Thanks & Regards, Vishnu.