Steve, you have an infinite loop, because your submitHandler is re-submitting 
the form, which then calls the validate handler, which then runs submitHandler 
and so on.  

The validation plugin will automatically submit the form if no errors are 
found, so you don't need to have a separate submitHandler function to submit 
the form.

-- Josh





----- Original Message ----- 
  From: Steve Blades 
  To: jquery-en@googlegroups.com 
  Sent: Thursday, October 04, 2007 11:59 AM
  Subject: [jQuery] Validation madness


  I'm using the validator plugin, and I have some code like this:

      var errContainer = $('#CSForm div.error');
      $('form#CSForm').validate({
          errorContainer: errContainer,
          errorLabelContainer: $("ol",errContainer), 
          rules: {
              First_Name: "required",
              Last_Name: "required",
              EMail: {
                  required: true,
                  email: true
              }, 
              Make: "required",
              Model: "required"
          },
          messages: {
              First_Name: "Please enter your First Name",
              Last_Name: "Please enter your Last Name", 
              EMail: "Please enter a valid email address",
              Make: "Please select a make",
              Model: "Please select a model"
          },
          wrapper: 'li', 
          submitHandler: rewriteMakeOption
      })

  ....

  function rewriteMakeOption(form){
      // some other stuff
      $(form).submit();
  }

  Trying to figure out what I'm doing wrong. I put some console logging into 
place, only to see that the form was submitted 222 times before it was stopped 
by Firefox (it killed IE completely). Anybody? 
  -- 
  Steve "Cutter" Blades
  Adobe Certified Professional
  Advanced Macromedia ColdFusion MX 7 Developer
  _____________________________
  http://blog.cutterscrossing.com 
  ---------------
  The Past is a Memory
  The Future a Dream
  But Today is a Gift
  That's why they call it
  The Present 

Reply via email to