seedy schrieb:
Is it possible to use errorPlacement with the validation plugin to have a
different placement for each field validated?

ie.
$('#testForm').validate({
        rules:{
                firstname:{required:true},
                integer:{required:true}
        }
})

I would like to have the error for firstname appended to $('#div1') , and
errors for integer before $('#div2')
You can use the errorPlacement option for that. Its far from perfect, but allows you to do every placement you can think of.

One example of the usage of errorPlacement can be found here: http://dev.jquery.com/view/trunk/plugins/validate/demo-test/milk/
The interesting part:

| // the errorPlacement has to take the table layout into account errorPlacement: function(error, element) { if ( element.is(":radio") ) error.appendTo( element.parent().next().next() ); else if ( element.is(":checkbox") ) error.appendTo ( element.next() ); else error.appendTo( element.parent().next() ); }, |

-- Jörn

Reply via email to