You shouldn't then use the message-callback for this functionality. Take a look at the highlight-option instead.
Jörn On Tue, Mar 24, 2009 at 3:35 PM, Andy Matthews <li...@commadelimited.com> wrote: > Okay... > > Another question. I'm having an odd issue with the message area of the > plugin, specifically with remote methods. When the remove method fires, as > in my original post. The problem is that I want to do some additional error > display when the error fires. Problem is that the message key appears to be > getting triggered whether there's an error fired or not. > > For example, I'm checking to see if a key exists in the database. If it > does, the message should be displayed, AND the fom field containing the key > should have it's background color changed. The problem is that the > background color changes whether the msg is displayed or not. Is this a bug, > or intended behaviour? > > Here's my code to this point. > > messages: { > pagealias: { > required: 'Page alias is required', > remote: function(){ > // also highlight the field containing the error > $field.pulse({ > backgroundColors: ['#fffffff','#ea7f1e'] > }).bind('focus', function(){ > $(this).recover(); > }); > return 'This page alias is already in use'; > } > } > } > > > andy > ________________________________ > From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On > Behalf Of Jörn Zaefferer > Sent: Monday, March 23, 2009 5:34 PM > To: jquery-en@googlegroups.com > Subject: [jQuery] Re: Validation plugin: combine functions with strings on > remote error > > Passing a function as a message happens all the time when using > $.format("... {0}") as messages. The function is expected to return the > formated message, so you can just return the string value you want to > display at the end of your function. > > Jörn > > On Mon, Mar 23, 2009 at 10:39 PM, Andy Matthews <amatth...@dealerskins.com> > wrote: >> >> I'm using the validation plugin to validate a field remotely. The >> validation >> portion works great, but I've got a question about the error message if >> the >> validation fails. >> >> I discovered that you can pass a function rather than a plain string as >> seen >> below in the remote key. The problem is that when I do this, I lose the >> ability to display a string of my choosing. Does anyone know how to >> accomplish both? >> >> messages: { >> pagealias: { >> required: 'Page alias is required', >> remote: function(){ >> // highlight the field >> $field.pulse(); >> // display message >> 'This page alias is already in use' >> } >> } >> } >> >> >> Andy Matthews >> Senior Web Developer >> >> www.dealerskins.com >> >> P Please consider the environment before printing this e-mail. >> >> Total customer satisfaction is my number 1 priority! If you are not >> completely satisfied with >> the service I have provided, please let me know right away so I can >> correct >> the problem, >> or notify my manager Aaron West at aw...@dealerskins.com. >> > >