Description:-
In this
Example we Explain that How to put validation on the TextBox that will only
allow alphbet Character and other Special Character or Number are not allowed
by using Javascript.
Here we use the Event Object that are used to Fetch
the ASCII code of the Character that is entered by user in the TextBox. If
Ascii code is Correspond to Alphabet then It will allow otherwise the other
character are not even written in Textbox means Disable the Other Key.
What is Validation:-
Validation Means to check the Data at Client side that the insert data by the user is Valid or not. if valid then and then the Request is transfer to the server oterwise it will Display a proper message like Only Digit is Allowed in this Checkbox.
so by using this Validation Functionality we will reduce the Traffic or load in the Server. so validation is must Required in any form or application.
What is Validation:-
Validation Means to check the Data at Client side that the insert data by the user is Valid or not. if valid then and then the Request is transfer to the server oterwise it will Display a proper message like Only Digit is Allowed in this Checkbox.
so by using this Validation Functionality we will reduce the Traffic or load in the Server. so validation is must Required in any form or application.
What
is Event Object:-
Event Object are Generally used within Fuction and
are used to Generate the Event.Some Important Property of the Event Object are
as Follows:
Altkey
:-
Returns whether or not the "ALT" key was
pressed when an event was triggered or Executed
Button :- Returns whether or not
the "ALT" key was pressed when an event was triggered
clientX :- Returns the horizontal
coordinate of the mouse pointer, relative to the current window, when an event
was triggered.
clientY :- Returns the vertical
coordinate of the mouse pointer, relative to the current window, when an event
was triggered.
Ctrlkey :- Returns whether or not
the "CTRL" key was pressed when an event was triggered
Metakey : - Returns whether or not
the "meta" key was pressed when an event was triggered
screenX :- Returns the
horizontal coordinate of the mouse pointer, relative to the screen, when an
event was triggered.
screenY :- Returns the vertical
coordinate of the mouse pointer, relative to the screen, when an event was
triggered
import contact From Gmail in our website in Asp.Net How to use Gmail contacts in our website
Implement Remember Me functionality using CheckBox ASP.Net
set WaterMark Text in PDF using itextsharp in C#
How to set Default Button in MVC Web Form Application
How to Bind XML File data to Treeview in asp.net
JQuery datepicker calender with Dropdown month and year in asp.net.
Code:-
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="kodemo.aspx.cs" Inherits="kodemo" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="Scripts/jquery-1.7.1.js">
</script>
<script src="Scripts/jquery-1.7.1.min.js"></script>
<script src="Scripts/knockout-2.1.0.js"></script>
<script type="text/javascript">
function Alphabets(nkey) {
var keyval
if (navigator.appName == "Microsoft
Internet Explorer") {
keyval = window.event.keyCode;
}
else if (navigator.appName == 'Netscape') {
nkeycode = nkey.which;
keyval = nkeycode;
}
//For A-Z
if (keyval >= 65 && keyval <= 90) {
return true;
}
//For a-z
else if (keyval >= 97 && keyval <=
122) {
return true;
}
//For Backspace
else if (keyval == 8) {
return true;
}
//For General
else if (keyval == 0) {
return true;
}
//For Space
else if (keyval == 32) {
return true;
}
else {
return false;
}
}// End of the function
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<p>Enter only Ahphabet Character</p>
<asp:TextBox ID="txtUsername"
onkeypress="return Alphabets(event);"
runat="server" />
</div>
</form>
</body>
</html>
kirit kapupara sir give the another server for send the sms
ReplyDeleteI wnt to use only expression dnt use keycode
ReplyDeleteplz czn u help me out
script type="text/javascript"
ReplyDeletevar r={
'special':/[\W]/g,
'quotes':/['\''&'\"']/g,
'notnumbers':/[^\d]/g,
'notletters':/[A-Za-z]/g,
'numbercomma':/[^\d,]/g,
}
function valid(o,w){
o.value = o.value.replace(r[w],'');
}
/script
HTML
input type="text" name="login" onkeyup="valid(this,'numbercomma')" /
This is really nice article have a look of this also
ReplyDeletehttp://www.aspdotnet-pools.com/2014/06/allow-only-alphabets-in-textbox-using.html
Hai its really nice article and its working fine. But if i open the site from proxy it's allowing to enter all the values. Is there any solution for that ? Im using PHP application.
ReplyDeleteXcellent Script for All Browsers....Thank u dear
ReplyDeletethanks for appreciate.
Deleterefer this link for perfect answer
ReplyDeletehttps://www.youtube.com/watch?v=KS1dV34xtzk
Aksaray
ReplyDeleteAydın
Kütahya
Rize
Bingöl
O3AXOF
Ankara
ReplyDeleteVan
Hakkari
Edirne
Yozgat
Y54
Iğdır
ReplyDeleteAdana
Karabük
Diyarbakır
Antep
O8G
https://titandijital.com.tr/
ReplyDeletesivas parça eşya taşıma
mardin parça eşya taşıma
karaman parça eşya taşıma
manisa parça eşya taşıma
XO7VO
37970
ReplyDeleteArtvin Lojistik
Çerkezköy Halı Yıkama
Karaman Lojistik
Kilis Şehirler Arası Nakliyat
Malatya Lojistik
Kırıkkale Şehirler Arası Nakliyat
Elazığ Şehir İçi Nakliyat
Çerkezköy Ekspertiz
Çerkezköy Petek Temizleme
C04BB
ReplyDeletebinance kod
05F66
ReplyDeleteBitcoin Yatırımı Nasıl Yapılır
Bitcoin Nasıl Oynanır
Discord Sunucu Üyesi Hilesi
Coin Nasıl Çıkarılır
Ön Satış Coin Nasıl Alınır
Btcturk Borsası Güvenilir mi
Paribu Borsası Güvenilir mi
Dlive Takipçi Satın Al
Likee App Takipçi Satın Al
FDF2D
ReplyDeleteweb ledger wallet
eigenlayer
ledger live app
web trust wallet
web arculus
ledger wallet
onekey wallet web
web trezor
web avax wallet