views:

130

answers:

1

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.

+1  A: 

I think it is simply a typo:

minlenght: 6

should be

minlength: 6
ryanoasis