title: In my code for validation i used jquery , in my form if any filed is missing mean it have raise error
body: <pre><code>&lt;script&gt;
         $.validate({
             errorMessgaePosition: 'top'
         });
          $(document).ready(function(){
              $("#form1").validate({
  
                  rules:{
                      firstname: "required",
                      lastname : "required",
                      username :{
                                  require:true,
                                  minlength:2
                      },
                      password :{
                                  require: true,
                                  minlength: 6
                      },
                      confirm :{
                                  require:true,
                                  minlength:6,
                                  equalTo:"#password"
                      },
                      email :{
                                  require:true,
                                  email: true
                      },
                      mobile :{
                                  require:true,
                                  minlength:10
                      },
                      gender :"required"   
                  },
                  messages:{
                      firstname:"Please first name should not be empty.",
                      lastname :"Please last name should not be empty.",
                      username:{
                                  require:"Please username should not be empty.",
                                  minlength:"Minimum length of username should be 2."
                      },
                      password :{
                                  require:"Please password should not be empty.",
                                  minlength:"Password must be  6 character."
                      },
                      confirm:{
                                  require:"Please re-type your password.",
                                  minlength:"Password must be  6 character.",
                                  equalTo :"Password should be equal."
                      },
                      email:{
                                  require:"Please email should not be empty.",
                                  email:"Please give valid email."
                      },
                      mobile:{
                                  require:"Please give mobile no.",
                                  minlength:"Mobile no. should be 10 digit."
                      },
                      gender:"Please choose gender."
                  },
  
              submitHandler: function(form){
              /* here other validation codes */
  
                      form.submit();
              }
          });
  
        });
      /* this for cancel button */
        $(document).ready(function(){
           $(".cancel").click(function(){
               validator.resetForm();
           }) ;
        });
  
  /*
  $(document).ready(function(){ 
          &amp;("#form1").validate({
              $("#username").focus(function(){
                  var firstname= $("#firstname").val();
                  var lastname= $("#lastname").val();
                  if( firstname &amp;&amp; lastname &amp;&amp; !this.value)
                  {
                      this.value= firstname +"."+ lastname;
                  }
              });
          });
  });
    */
      &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;h3&gt;***Registration Form***&lt;/h3&gt;
      &lt;form id="form1"  action="#" novalidate="novalidate"&gt;
          &lt;div id="box"&gt;    
              &lt;div class="label"&gt;&lt;label for="firstname"&gt;First Name :&lt;/label&gt;
                  &lt;input id="firstname" type="text" name="firstname" /&gt;
              &lt;/div&gt;
              &lt;div class="label"&gt;&lt;label for="lastname"&gt;Last Name : &lt;/label&gt;
                  &lt;input id="lastname" type="text" name="lastname" /&gt;
              &lt;/div&gt;
  
              &lt;div class="label"&gt;&lt;label for="username"&gt;Username : &lt;/label&gt;
                  &lt;input id="username" type="text" name="username" /&gt;
              &lt;/div&gt;
              &lt;div class="label"&gt;&lt;label for="password"&gt;Password : &lt;/label&gt;
                  &lt;input id="password" type="password" name="password" /&gt;
              &lt;/div&gt;
              &lt;div class="label"&gt;&lt;label for="confirm"&gt;Confirm Password :&lt;/label&gt;
                  &lt;input id="confirm" type="password" name="confirm"/&gt; 
              &lt;/div&gt;
              &lt;div class="label"&gt;&lt;label for="email"&gt;Email : &lt;/label&gt;
                  &lt;input id="email" type="email" name="email" /&gt;
              &lt;/div&gt;
              &lt;div class="label"&gt;&lt;label for="mobile"&gt;Mobile No. : &lt;/label&gt;
                  &lt;input id="mobile" type="tel" name="mobile" /&gt;
              &lt;/div&gt;
              &lt;div class="gender"&gt;Gender :
                  &lt;input class="gender1" type="radio" name="gender"&gt;Male
                  &lt;input class="gender1" type="radio" name="gender"&gt;Female
              &lt;/div&gt;
              &lt;div class="but"&gt;   
                  &lt;input id="submit" type="submit" value="Submit"&gt;
                  &lt;input id="cancel" type="reset" value="Cancel"/&gt;
              &lt;/div&gt;
           &lt;/div&gt;  
      &lt;/form&gt;     
  </code></pre>