decbrad
decbrad

Reputation: 191

Validation error placement in Bassistance

i'm using Bassasistance jQuery validation and so far it seems to be great! I've a quick question regarding the error placement.

At the moment, as can be seen below, I am targetting the <small> tag, which I also use as a hint for what the user should type into the field. If validation fails, I would like to replace the current hardcoded contents with the relevant message from the script. When validation fails it looks like it's just adding another <small> element under my own one

Any ideas would be great!

The page can be found online at http://www.st-patricks-day-2011.com/addlisting.asp

Here's the code that I am using

$("#paradeEventForm").validate({
  errorElement: "small",

  rules: {
    name: "required",
    description: "required",
    keywords: "required",
    address: "required",
    country: "required",
    eventDate: "required",
    websiteAddress: "required"
  },

  messages: {
    name: "Please enter a title for your Parade or Event",
    description: "Please enter a description for your Parade or Event",
    keywords: "Please enter some keywords that describe your Parade or Event",
    address: "Please enter the starting point of your Parade or Event",
    country: "Please enter the country where your Parade or Event is taking place",
    eventDate: "Please enter a date for your Parade or Event",
    websiteAddress: "Please enter the website address of you Parade or Event"
  }
});

Upvotes: 1

Views: 1089

Answers (1)

Marcus S&#225;
Marcus S&#225;

Reputation: 608

If i understood your question, you can try replace the small content in the errorPlacement:

errorPlacement: function(error, element) {
    element.searchforyoutsmall.html(error;
},

Upvotes: 1

Related Questions