jQuery Validation error...

Posted by Povylas on Stack Overflow See other posts from Stack Overflow or by Povylas
Published on 2010-05-18T17:27:50Z Indexed on 2010/05/18 17:30 UTC
Read the original article Hit count: 376

Filed under:
|

Hi,
I have been struggling with this jQuery Validation Plugin. Here is the code:

<script type="text/javascript">
$(function() {

var validator =   $('#signup').validate({
    errorElement: 'span',
  rules: {
   username: {
        required: true,
        minlenght: 6
        //remote: "check-username.php"
        },
   password: {
    required: true,
    minlength: 5
   },
   confirm_password: {
    required: true,
    minlength: 5,
    equalTo: "#password"
   },
   email: {
    required: true,
    email: true
   },
   agree: "required"
  },
  messages: {
   username: {
    required: "Please enter a username",
    minlength: "Your username must consist of at least 6 characters"
    //remote: "Somenoe have already chosen nick like this."
   },
   password: {
    required: "Please provide a password",
    minlength: "Your password must be at least 5 characters long"
   },
   confirm_password: {
    required: "Please provide a password",
    minlength: "Your password must be at least 5 characters long",
    equalTo: "Please enter the same password as above"
   },
   email: "Please enter a valid email address",
   agree: "Please accept our policy"
  }

});

var root = $("#wizard").scrollable({size: 1, clickable: false});



// some variables that we need
var api = root.scrollable();

$("#data").click(function() {
  validator.form();
});

// validation logic is done inside the onBeforeSeek callback
api.onBeforeSeek(function(event, i) {

    if($("#signup").valid() == false){
      return false;
    }else{
      return true;
    }



$("#status li").removeClass("active").eq(i).addClass("active");


 });


 //if tab is pressed on the next button seek to next page
root.find("button.next").keydown(function(e) {
 if (e.keyCode == 9) {

  // seeks to next tab by executing our validation routine
  api.next();
  e.preventDefault();
 }
});
$('button.fin').click(function(){
     parent.$.fn.fancybox.close()
});


});
</script>

And here is the error:

$.validator.methods[method] is undefined
http://www.vvv.vhost.lt/js/jquery-validate/jquery.validate.min.js
Line 15

I am completely confused... Maybe some kind of handler is needed?
I would be grateful for any kind of answer.

© Stack Overflow or respective owner

Related posts about jquery-ui

Related posts about jquery-validate