Welcome to YLOAN.COM
yloan.com » Domain Name » Email, Username, Password, Url Validation Using Jquery
Online Business Site Promotion Web misc Affiliate-Revenue Auctions Audio-Streaming Autoresponders Blogging-Rss Email-Marketing Ezine-Publishing Forums Internet-Marketing List-Building PPC-Advertising Podcasting SEO Spam-Blocker Traffic-Building Video-Streaming Web-Design Web-Development Web-Hosting Domain Name soreness web analysis vinyl mlm searching media info spyware access microsoft outlook farmville

Email, Username, Password, Url Validation Using Jquery

Email, UserName, password, URL Validation using JQuery in Asp.net.


In this Article we will see Some useful validation Using JQuery in asp.net using Jquery Validation Plug-in must be useful for Login page or User Registration page etc..

We will also see how to perform validation in a asp.net web page which uses master page.

As we know that JQuery is a javascript library and using thins we can able to write some like animation, Validation using minimum code.


Lets Start with first with a page which does not uses Master Page and later in this article we will see JQuery Validation with Master Page.

Step 1 : Download the JQuery Plug in from Here and JQuery Validation Script Plug-in From here both are .js file.

Step 2 : Add the above file reference in your asp.net web page under

Page

Eg.

1

2

Step 3: Declare asp.net text box in your form

1

Step 4: Now add you Jquery validation code inside tag under tag.

For eg in this we have taken a text box with id txtUserName and form name form1

01

02$(document).ready(function() {

03"#form1").validate({

04true

05},

06messages: {

07:{

08required: "Plaese Enter your username",

09"User name must be atleaet of 5 characters"

10

Now we will see one by one Email, UserName, password, URL Validation using JQuery in Asp.net.

UserName Validation Using JQuery

below is the JQuery Script to validate User Name whhich is required field and Accept minimum 5 Characters

01

02$(document).ready(function() {

03"#form1").validate({

04true

05}

06}, messages: {

07:{

08required: "Plaese Enter your username",

09"User name must be atleaet of 5 characters"

10

and HTML Code for the UserName Textbox



Password Require field Validation using JQuery

Below is JQuery code to validate Password Field which is required field and should have minimum 5 characters

01

02$(document).ready(function() {

03"#form1").validate({

04true

05}

06}, messages: {

07:{

08required: "Plaese Enter your password",

09"Password must be atleaet of 5 characters"

10

and the HTML code for the Password Field which is required field and should have at least 5 characters

1


Email Validation Using JQuery

here is the script to validate Email using JQuery

1

2$(document).ready(function() {

3"#form1").validate({

4true

5}

6}, messages: {

7:{

8required: "Plaese Enter your Email Id",

9

And HTML code for the input TextBox

1


Note: Here you have to set CssClass properties to "email" to validate Email Format other wise it will not validate email format.

URL Validation using JQuery

Below is Script to validate URL of website using JQuery

1

2$(document).ready(function() {

3"#form1").validate({

4true

5}

6}, messages: {

7:{

8required: "Plaese Enter Website URL",

9

and the HTML code for the input Textbox for the URL

1


Note: Here you have to set CssClass properties to "url" to validate URL Format other wise it will not validate URL format.

JQuery Validation using Master Page

Now if you have Master page and than another webpage which consume master page than just add the reference of the script inside Head tag and in a webpage say you have

Registar.aspx than go to registar.aspx page and inside the content Tag you can Write your script tag this is the only difference of implementation of JQuery Validation for with and without master page for eg

01


02

03$(document).ready(function() {

04"#aspnetForm").validate({

05true

06}

07}, messages: {

08:{

09required: "Plaese Enter your username",

10"User name must be atleaet of 5 characters"

11

12

13

14

15


16

17

18

19

20


21

22

23

24

Error Message Decoration

To Decorate error message generated by Jquey you can use css like this and you can add this your custom css file you inside Head Tag

1

2label.error { color: red; vertical-align: top; }

3

What is the Difference Between Asp.Net Validation control and jQuery Validation and which one good.

Well the difference is Asp.net validation control will execute both in Client and server side if javascript is disabled than validation control will fired in server side where as JQuery plug-in is based

on javascript and so will will fire in client side. Now if up to you which on you should use.

jQuery Plug in is tested on IE, Firefox, Safari, Chrome and most other popular browser.


Hope this will help all to understand JQuery Validation in your asp.net web page.

If you run the sample project attached below and run it you will see JQuery validation result like this

You can download the sample code used in above example.

by: dvpglobal
2011 Volkswagen Jetta Named One Of Kelly Blue Book's 10 Coolest Cars Wearing Name Badges To Inform Kyriba Named Techamerica High Tech Awards Finalist What Global Domains International Can Do For You Protect Your Brand Name Through Trademark Protection Discover The Secret Behind Your Name San Francisco 49ers Tickets : Willis Was Named The 2007 Ap Nfl Defensive Rookie Of The Year Female Dog Names | How To Pick 'em Choosing A Good Domain Name Precisely Why Accomplish Companies Utilize Username Members Along With Charitable Trust Goods Best Quality Hawaii Ornaments Named For The Cool Diamond Plate Pattern In The Background How To Find Great Boy Dog Names
print
www.yloan.com guest:  register | login | search IP(216.73.216.180) California / Anaheim Processed in 0.034817 second(s), 7 queries , Gzip enabled , discuz 5.5 through PHP 8.3.9 , debug code: 242 , 6292, 308,
Email, Username, Password, Url Validation Using Jquery Anaheim