Form validation Using Jquery Plugin

Form validation Using Jquery Plugin

Hello sir

I want to implement form validation using JQuery Plug-in. My code is :

<html>
<style type="text/css">
    * { font-family: Verdana; font-size: 11px; line-height: 14px; }
    .submit { margin-left: 125px; margin-top: 10px;}
    .label { display: block; float: left; width: 120px; text-align: right; margin-right: 5px; }
    .form-row { padding: 10px 0; clear: both; width: 800px; }
    label.error { width: 250px; display: block; float: left; padding-left: 10px; }
    input[type=text], textarea { width: 250px; float: left; }
    textarea { height: 50px; }
  </style>
</head>
<body>

<body>
<h3><font color="blue">Please enter the following information</font></h3>

  <form method="post" action="">
      <div class="form-row"><span class="label">Name *</span><input type="text" name="name" id="namei"/></div>
      <div class="form-row"><span class="label">E-Mail *</span><input type="text" name="email" id="emaili"/></div>

      <div class="form-row"><span class="label">URL</span><input type="text" name="url" id="urli" /></div>
      <div class="form-row"><span class="label">Age</span><input type="text" name="quantity" id="quantity" /></div>

      <div class="label.error" id="errmsg"></div>
      <div class="form-row"><span class="label">Your comment *</span><textarea name="comment" id="commenti"></textarea></div>
      <div class="form-row"><input class="submit" type="submit" value="Submit" name="submit" id="submiti"></div>
    </form>
</body>
</html>

Please provide me JQuery code regarding above code ASAP.

View Answers

December 15, 2010 at 12:41 PM

First you need to download jquery.validate.js plugin. Here is the code according to your description :

<script type="text/javascript" src="jquery.validate.js"></script> <script type="text/javascript">

$(document).ready(function(){
       //called when key is pressed in textbox  $("#quantity").keypress(function (e)    {   $("#errmsg").hide();      //if the letter is not digit then display error and don't type anything     if( e.which!=8 && e.which!=0 && (e.which<48 || e.which>57))     {         //display error message         $("#errmsg").html("&nbsp;&nbsp;Digits Only").show(); 
       return false;
      }       });     $('#quantity').blur(function(a) {       if((parseInt($("#quantity").val(), 10)<18))     {
      $("#errmsg").html("&nbsp;&nbsp;Age must be greater than 18").show(); 
          }       if((parseInt($("#quantity").val(), 10)>35))     {
      $("#errmsg").html("&nbsp;&nbsp;Age must be less than 35").show();       }      });
    //FOR EMAIL ADDRESS     $("#form").validate({
        rules: {
          name: "required",// simple rule, converted to {required:true}
          email: {// compound rule
          required: true,
          email: true
        },
        url: {
          url: true
        },
        comment: {
          required: true
        }
        },
        messages: {
          comment: "Please enter a comment."
        }
      });    });   </script>









Related Tutorials/Questions & Answers:
Form validation Using Jquery Plugin
Form validation Using Jquery Plugin  Hello sir I want to implement form validation using JQuery Plug-in. My code is : <html> <style type...; } .form-row { padding: 10px 0; clear: both; width: 800px; } label.error { width
Html form validation using jquery
Html form validation using jquery  Hi i am using form with html. Form elements like textbox, radio,checkbox,listbox i was used now how to validate the elements using submit jquery option
Advertisements
HTML form validation using jquery
HTML form validation using jquery  Is there any way for validating html elements common under a class by giving its class name in jquery validation code..that means validating all elements by using its class name if those
Jquery form validation does not work
Jquery form validation does not work  I want to use jquery validation...({}); JQuery Form Validation The above link provide you a good example of validating a form using jquery with illustration
Jquery form validation does not work
Jquery form validation does not work  I want to use jquery validation...({}); JQuery Form Validation The above link provide you a good example of validating a form using jquery with illustration
Form validation using jQuery plug in & JSP
Form validation using jQuery plug in & JSP In this tutorial, we will discuss about form validation using jQuery plug in & display of submit content using JSP. In the given below example a form is given ,whose fields  like
Please provide jquery inline form validation for the code
Please provide jquery inline form validation for the code   <...="white"> <form action="Student1Servlet" method="post" enctype="multipart/form... the following link: http://www.roseindia.net/tutorial/jquery
Please Provide jquery inline form validation
Please Provide jquery inline form validation  <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd...;/head> <body> <form action="LabAccountServlet" method="post"><
form validation
form validation  how the form validation is done in jsf form using javaScript
Ajax form validation Example
Ajax form validation Example  Hi, I want to validate my ajax form. Please give me good code for Ajax form validation. Thanks (adsbygoogle... in Ajax using jQuery framework. Thanks (adsbygoogle
How to save form data to a csv file using jquery or ajax
How to save form data to a csv file using jquery or ajax  Please let... data to a csv file using ajax/jquery only i am not suppose to use database... am suppose to use only jquery or ajax for doing this. i am able to read
Form Validation
Form Validation  Java script validation for checking special characters and white spaces and give an alert.Please help me urgent Thanks in advance
JQuery as validation controller
JQuery as validation controller  I would love to use JQuery as validation controller but i don't know how i use.Could u help me?   Here is a link that will provide you an example of validating email using jquery
How to reset a form in jQuery?
How to reset a form in jQuery?  Hi, I have a form where I am using jQuery. I want to reset the form. How I can reset the form grammatically?   Hi, (adsbygoogle = window.adsbygoogle || []).push({}); You
jQuery email validation
jQuery email validation  Hi, I am using jQuery in my PHP based web application. I have to validate the email address entered by user on the form. I... is not correct. Give me good example code for validing email address in jQuery. Thanks
JavaScript Form Validation
JavaScript Form Validation  JavaScript Form Validation
form validation
form validation  <form name="form" method="post" action="process.php" onsubmit="return validate(); "> <table align="center" border="1px... want validation code,username minimum 8 char,password length must >6,and one
Form validation
Form validation  Hi Everyone Can someone assist me with a complete code to validate a form. e.g where the user must insert an ID number it should check if the user entered the correct data and within a valid range. This must
spring form validation
spring form validation  how can we validate a web form using spring, try to give an example of the form containing some fields and their validations,ASAP......   Please visit the following link: Spring form validation
How to create runtime drag and drop form builder using asp.net mvc and jquery
How to create runtime drag and drop form builder using asp.net mvc and jquery  My task is related to Runtime drag and drop Form Builder. I have to design a dynamic form builder in which user has permission to drag the control
Custom Form Validation - PHP
Custom Form Validation  Which is the best way or where should I implement the custom validation rules such as ? using number, capital letters and symbols to secure the password
jQuery plugin examples code
:  Form validation using jQuery plug in & JSP... jQuery plugin examples code       jQuery plugin examples code Following
HTML Form Validation example
HTML Form Validation example  Can anyone guide me how to validate the user name and password field in HTML using simple or JavaScript Validation. Thanks in advance!   <form method="post" onsubmit="return
login form validation - JSP-Servlet
login form validation  hi, how to validate the login form that contains user name and password using post method . the validation should not allow user to login in the address bar thanks regards, anand
please check my code is wrong or ok.it was not work .this is form validation in javascript using jsf page
Form validation in javascript using jsf page  ?xml version='1.0' encoding='UTF-8' ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional...; &lt;f:view&gt; &lt;h:form id="form2" onsubmit
please check my code is wrong or ok.it was not work .this is form validation in javascript using jsf page
please check my code is wrong or ok.it was not work .this is form validation in javascript using jsf page  <p>?xml version='1.0' encoding...; &lt;f:view&gt; &lt;h:form id="form2" onsubmit="return
Form Validation with JavaScript
Form Validation with JavaScript  I created a simple form including nine or ten fields in HTML, and i want to validate it in JavaScript. How can i do...; <script src="validateForm.js"> </script> <form name="form
javascript form validation
javascript form validation  How to validate radio button , dropdown list and list box using onsubmit event..please give me a sample example..If we do...; } </SCRIPT> </HEAD> <form name="f1" onsubmit ="return validate
jquery start date end date validation
jquery start date end date validation  Using JQuery how can i validate the end date and start date? for example if the start date is grater than...").rules('add', { greaterThan: "#StartDate" }); or $("form").validate
Disabling submit button using jQuery
Disabling submit button using jQuery  Hello Sir I want to know - is there any way or approach to disable client side form's "Submit" button...({});   For all submit buttons, via JQuery, it'd be: $('input[type
file upload plugin in jquery
file upload plugin in jquery  file upload plugin in jquery   You can use the following code to use the JQuery plugin. $(document).ready(function() { $("#uploadbutton").jsupload({ action: "addFile.do
Using the jQuery Transform plug-in(XSLT)
Language Transformations ). The jQuery Plugin we are using... Using the jQuery Transform plug-in(XSLT)       Using the jQuery Transform plug-in(XSLT
jQuery 'submit' form event
jQuery 'submit' form event In this tutorial, we will discuss about the  'submit' form event of jQuery. In this example... when "submit" event return 'true' to 'form'
Vertical news slider using jquery
Vertical news slider using jquery  how to creatw vertical news slider using jquery Sorry for wrong category but i cant get my jquery category
PHP JavaScript form Validation - PHP
PHP JavaScript form Validation  Just looking for a general PHP JavaScript form Validation. How can I write external JavaScript Validation? Please suggest!  Hi Friend, 1) form Enter Name Enter Address
Show Limited Data Using jquery
Show Limited Data Using jquery  How to show limited results in JQuery... it using JQuery?   See the JQuery example to show the limited fetch results in JQuery. var comments = $('.description_text').size(); if (comments >
create a form using struts
create a form using struts  How can I create a form for inputting text and uploading image using struts
jQuery password validation
jQuery password Validation : jQuery "equalTo: "#password" "... the validation by clicking on the submit button. online demo: jQuery required... validation we can check that password and verify password are equal.   
jQuery email validation
jQuery Email Validation : jQuery "required email" is the method... || []).push({}); online demo: jQuery email validation...; Getting Started with jQuery "required email" : In this example
JQuery url validation
jQuery url Validation : jQuery "required url" is the method... the jQuery part , the jQuery required for  the checking the validation... demo: jQuery required validation
validation using validate method
validation using validate method  HOW TO DO THE VALIDATION IN THE STRUTS 2 USING VALIDATE METHOD IN ACTION CLASS,AND ALSO AM HAVING MY BEAN CLASS AS SEPERATE. I HAD TRIED THAT BUT IT WAS NOT WORKING PROPERLY. IF U KNOW
validation of strings using java function
validation of strings using java function  hi all, i am uploading data from csv file to data base where i took student id as string of length 6 char of the form abc123 will you please give me a function to validate this field
Introduction to jQuery plugin
Introduction to jQuery plugin       Introduction to jQuery plugin JQuery plugins... , you need to set attribute according to the plugin definition . For jQuery
jQuery required validation
jQuery required Validation: jQuery "required" is the method...;/option>. Getting Started with jQuery required : (adsbygoogle... which are used to make jQuery required. This example  Makes "
Example of login form validation in struts2.2.1framework.
Example of login form validation in struts2.2.1 framework. In this example, we will introduce you to about the login form validation in struts2.2.1 framework. Our login form validation example does not validate the user against
application using AJAX and JQuery and also use JSP
application using AJAX and JQuery and also use JSP   i need create an application using AJAX and JQuery and also use JSP
jQuery to validate Email Address Validation
jQuery to validate Email Address       In this  jQuery tutorial we will develop a ... the  program for Email Address Validation Step 1: Create php file
Using the jQuery event object
Using the jQuery event object       Using the jQuery event object JQuery... to these standards, this system normalize the event object. jQuery. Event
jQuery Demos
change event with multiple select option Form validation using jQuery... with an element using 'bind' jQuery 'select' form... in different file Display current time using jQuery & JSP
Difference between jQuery UI widget and plugin
is a pretty and easy way of using a plugin. Learn from experts! Attend jQuery... Difference between jQuery UI widget and plugin  ... and plugin Widgets are part of the jQuery UI library, where plugins aren

Ads