I don't have much of a clue how to code what you mean
with the errorPlacement function:
Here's what I tried, which didn't work...everything else runs
fine without it... remember, unfortunately you're helping someone
who has just begun to work with jQuery and the plug-ins... :o)
$.validator.defaults.debug = true;
$().ready(function() {
// validate Mortgage_Calculation_Form form fields on blur
$("#MC_Form").validate({
errorPlacement: function(error, #Principal) {
error.insertBefore(#Principal);
},
focusInvalid: "false",
event: "blur",
rules: {
Principal: {required: true},
Interest: {required: true,
number: true},
Years: {required: true,
number: true}
},
messages: {
Principal: "Please enter the Principal.",
Interest: {required: "Please enter the
Interest Rate.",
number: "Please enter a
number."},
Years: {required: "Please enter the Years.",
number: "Please enter a number."}
}
})
});
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Jörn Zaefferer
Sent: Thursday, March 08, 2007 5:30 PM
To: jQuery Discussion.
Subject: Re: [jQuery] Options for Validation...
Rick Faircloth schrieb:
>
> Calling all jQuery/CFers
>
> Im not real satisfied with the error message placement
>
> options in Jorn Zaefferers validation plug-in.
>
> I like to place my error messages right above the form field
>
> that the error message references.
>
> Right now, as I understand it, Jorns plug-in doesnt allow
>
> for that type of placement.
>
Forgot that other message. Well, parts of it. You can customize the
error placement!
Just implement the errorPlacement function:
$("#myform").validate({
errorPlacement: function(error, element) {
// do whatever you like with error and the element, eg.:
error.insertBefore(element); // <- inserts the error before the element,
use next() or prev() or parent() on element etc. to navigate through the DOM
}
});
--
Jörn Zaefferer
http://bassistance.de
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/