On 2/8/07, Jörn Zaefferer <[EMAIL PROTECTED]> wrote:

Your feedback is highly appreciated! We should be able to create the
definite solution for jQuery form validation...


A couple of things:

-- You should document the fact that, by default (i.e. when you're not using
the errorContainer or errorLabelContainer options) , error messages are
inserted into the DOM after the input they're associated with

-- Would it be possible to do something like this:

$("#myform").validate({
   rules: {
        firstname: { required: true },
        age: { number: true },
        password: { min: 5, max: 32 }
   },
   messages {
       password: {
           min: "Please enter a password greater than 5 characters",
           max: "Please enter a password less than 32 characters"
       }
   }
});

-- It would be nice if I could use this as a beforeSubmit callback in this
form plugin, rather than using the form plugin as a submit callback for this

Otherwise, it's looking pretty good, Jorn!

As an aside (and some shameless self promotion), you should NEVER use
JavaScript as your only validation method because you cannot rely on
JavaScript being available. Period[1].

You should ALWAYS duplicate your validation using server side code, that way
there is no way for anyone to bypass your validation routines. As it happens
(here it comes....), I've been working on a validation library in PHP[2] and
one of my next goals is to be able to export the rules and error messages
(most likely as JSON) so they can be used by JavaScript (like Jorn's). I was
going to write my own jQuery plugin, but perhaps I'll just write a small
wrapper around this one.

[1]
http://www.456bereastreet.com/archive/200612/you_cannot_rely_on_javascript_being_available_period/
[2] http://aheimlich.freepgs.com/projects/php/hvalidator
--
Aaron Heimlich
Web Developer
[EMAIL PROTECTED]
http://aheimlich.freepgs.com
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to