Exactly!

 

-Dan

 

  _____  

From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Mandy Singh
Sent: Tuesday, May 15, 2007 2:06 PM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: Form Validation Plugin

 

Oh! Didn't know that. Thanks for pointing that out Dan (I am new to jquery
had been using prototype till now).

So, just the packed version of the file is good enough?

And using that I can define the rules such as - 

$("#myform").validate({


 event: "keyup"


       rules: {


              firstname: { required: true },


              age: {


                      required: "#firstname:blank",


                      number: true,


                      minValue: 3






              },


              password: {


                      required: function() {


                              return $("#age").val() < 18;


                      },


                      minLength: 5,


                      maxLength: 32


              }


       },


 messages {


              password: {


                      required: "Your password is required because you are
not yet 18 years or older."



                      minLength: "Please enter a password at least 5
characters long.",


                      maxLength: "Please enter a password no longer then 32
characters long."


              },


              age: "Please specify your age as a number (at least 3)."



       }


});

 

On 5/15/07, Dan G. Switzer, II <[EMAIL PROTECTED]> wrote:


Mandy,

>I had a look at that before I posted. That does what I want but for simple
>validations I can't include 40-50 KB of code (cmforms, meta.js,
>jquery.validate)...thats an overkill when I just want a required:true 
>check.
>
>Any other?

The only thing that is required is jquery.validate.js. The packed version of
the file is only 6k.

The meta.js file is only required if you want to define validation rules 
using the class attribute of your tags.

The other libraries are used just for layout in the examples.

-Dan





 

Reply via email to