Take a look at some of the demos, eg. the Remember The Milk demo:
http://jquery.bassistance.de/validate/demo/milk/

You can customize the error further with the errorElement and
errorClass options. The resulting element needs to have a
for-attribute pointing to the associated input, otherwise the plugin
can't update it later on.

Jörn

On Thu, Oct 1, 2009 at 5:27 PM, Samuurai <djbe...@gmail.com> wrote:
>
> I have just realised that you were the coder behind this -
>
> My apologies..I didn't realise the flexibility of errorPlacement.
>
> I got it working to a certain degree.. here's my code:
>
>                ,errorPlacement: function(error,element){
>
>                        $('[for='+element.attr("name")+']').parents('.grid-26')
>
>                        .prepend('<p>'+error.text()+'</p>')
>
>                        .wrapInner('<div class="error"></div>');
>
>                }
>
> It applies the error and displays the message, but it infinitely
> applies the error, placing more and more divs around it. when I click
> on the input area and off it again. Also, how do I make it remove the
> errors?
>
> I thought it was using the success: method and using this code:
> var error = label.parents('.error');
> error.siblings().remove();
> error.replaceWith(error.children());
>
> But it didn't work.... basically I don't really know what I'm doing :)
>
>
> On Oct 1, 11:24 am, Samuurai <djbe...@gmail.com> wrote:
>> Thanks Jorn I'm looking at that, however I think I've devised another
>> method.
>>
>> I need this code to be run on each offending field:
>>
>>         $('[for=name]').parents('.grid-26') // for=name is the selctor for
>> the label.
>>                 .prepend('<p>Please write your real name</p>')
>>                 .wrapInner('<div class="error"></div>');
>>
>> });
>>
>> I only really have a background in PHP, so in PHP terms, how do I do
>> a    foreach ($errors as $error) and then call the above code with the
>> selector and the error message?
>>
>> Thanks!
>>
>> Beren
>>
>> On Oct 1, 9:01 am, Jörn Zaefferer <joern.zaeffe...@googlemail.com>
>> wrote:
>>
>> > Take a look at the errorPlacement option, documented 
>> > here:http://docs.jquery.com/Plugins/Validation/validate#toptions
>>
>> > Jörn
>>
>> > On Thu, Oct 1, 2009 at 12:53 AM, Samuurai <djbe...@gmail.com> wrote:
>>
>> > > Hi,
>>
>> > > I have got some very rudimentary validation working with JQuery
>> > > validation, however, by default, it creates some label tags with the
>> > > error messages in them, right next to the input tags which have
>> > > errors.
>>
>> > > How can I control where these error messages are displayed, as they're
>> > > inside the same div as the input tag which is causing display issues.
>>
>> > > I'm very new to JQuery so please elaborate a little bit if you can.
>>
>> > > Thanks!
>>
>> > > B

Reply via email to