Monday, September 15, 2008

jQuery Validation and the Google Toolbar

I am one of many happy users of the jQuery Validation plugin by Jörn Zaefferer, but I had some trouble with the Google Toolbar's auto-fill feature. When enabled, it adds a tooltip to text input fields it didn't auto-fill that says:

Your Google Toolbar can fill this in for you. Select AutoFill

One of the ways to tell the validation plugin which error message to show is by... setting the 'title' attribute, so when the Toolbar is installed all the error messages are "Your Google Toolbar can...."

Jörn has addressed the Google Toolbar issue since version 1.0, but in a way that doesn't let me use my preferred method of customizing the validation error messages.

So now there's a trac ticket including a patch with a new 'ignoreTitle' option that fixes this (if you don't use 'title' yourself).

[Edit: 26 October, 2008] Jörn has commited my patch, you can get the latest jQuery Validate plugin with Subversion:

svn co http://jqueryjs.googlecode.com/svn/trunk/plugins/validate

[Edit: 3 November, 2008] Only 'jquery.validate.js' contains the patch in svn - the minified and packed versions don't. Use the YUI Compressor or the CompressorRater to minify them yourself. Thanks to Ilan Berkner for catching this.

[Edit:21 November, 2008] Here's a direct link to the file

[Edit:8 December, 2008] Version 1.5 of the Validation plugin now contains this patch.

5 comments:

  1. Could you provide a more specific example of how to use this variable? I downloaded the JS with this patch but I don't understand how to use it... thanks

    In what section (messages, rules, etc) of the validate segment do I specifiy "ignoreTitle:true"?

    ReplyDelete
  2. You pass 'ignoreTitle:true' on its own - it's in the same level as 'messages' and 'rules':

    $('#myform').validate({
        ignoreTitle:true,
        messages: {
            ...
        }
    });

    ReplyDelete
  3. Any chance someone could post a link to the patched '.js' file?

    Clearly I'm SVN challenged...or the firewall I'm behind won't let me connect to http://jqueryjs.googlecode.com/

    Thanks.

    ReplyDelete