Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 2 of 2

Thread: errorPlacement

  1. #1
    Junior Member
    Join Date
    Feb 2010
    Posts
    18
    Member #
    21141
    Hi guys. I'm trying to make a contact form with the Jquery validation plugin.
    I was wondering how can I specify the error message ( for example the name error ) to insert after a label.

    I have this code:
    Code:
    $(document).ready(function(){
        
    $("#form").validate({
        
     rules: {
        
    name: "required",
    email: {
              required: true,
              email: true 
            },    
            
    subject: "required",
    message: "required"
    },
    
     
    messages: {
    
    name: "write your name!",
    email: {
            required: "write your email address!",
              email: "Invalid email address. Try again!", 
            },
        
    subject: "write a subject!",
    message: "write your message!",
    },
    
    
    errorPlacement: function(error, element) {
         error.insertAfter("#name_label")
        
    }
    })
    });
    I can make the error's go to the place i want, after the label I name, but I wanted to specify and put the each error in the respective label. Does anyone can tell me how can I do this please?

    ahh, and other question. Can i make, after having all fields validated and the mail sent, a image to appear on a div, by changing one image for another?

    thanks

  2.  

  3. #2
    Senior Member
    Join Date
    Jun 2005
    Location
    Atlanta, GA
    Posts
    4,146
    Member #
    10263
    Liked
    1 times
    If you want to put it in the label, try [minicode]error.appendTo("#name_label")[/minicode] (instead of insertAfter).


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 05:36 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com