On 08/03/07, Rick Faircloth <[EMAIL PROTECTED]> wrote: > 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/CF'ers… > > > > I'm not real satisfied with the error message placement > > > > options in Jorn Zaefferer's 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, Jorn's plug-in doesn't 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
I guess you want everything before Principal? Try this instead: errorPlacement: function(error, element) { $(error).before("#Principal"); }, Untested though (I haven't used Jörn's plugin yet, but I think I know how errorPlacement works). _______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/