Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 552287
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:29:00+00:00 2026-05-13T11:29:00+00:00

I have a form that uses the validation plugin, but I need to validate

  • 0

I have a form that uses the validation plugin, but I need to validate a separate part of the form using slightly different criteria – most of the fields place the error in the next table cell, but for one field I need the error placed somewhere else.

This is the validate function for the main form fields:

jQuery("#form2").validate({
    rules: {
        street: {
            required: true,
            minlength: 5
        },
        city: {
            required: true,
            minlength: 3
        },
        state: {
            required: true
        },
        zip: {
            required: true,
            minlength: 5
        }
    },
    messages: {
        street: {
            required: "Please enter your address",
            minlength: "Address is too short"
        },
        city: {
            required: "Please enter your town/city",
            minlength: "Town/City is too short"
        },
        state: {
            required: "Please enter your county"
        },
        zip: { 
            required: "Please enter your postcode",
            minlength: "Postcode is too short"
        }
    },
    errorPlacement: function(error, element) {
            error.appendTo(element.parent("td").next("td"));
    }
}); // end validate

Basically I would also like to validate this fieldset separately, so a different value can be used for errorPlacement:

    jQuery("#elecfields").validate({
    rules: {
        sup1: {
            minlength: 2
        }
    },
    messages: {
        sup1: {
            minlength: "must be 2 digits"
        }
    },
    errorPlacement: function(error, element)
    {
        // different error placement is needed here
    }

}); // end elecfields validate

elecfields is a fieldset inside form2 – but this doesn’t seem to work.

It seems that the errorPlacement must apply to all fields in the form, but I just have that one field that needs the error places somewhere else. Any ideas for how this can be achieved? Any help is very much appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T11:29:00+00:00Added an answer on May 13, 2026 at 11:29 am

    You’re right. The errorPlacement handler does apply to the entire form, but you can also have logic in there to handle the error differently in certain situations. For instance, you could look at the element property direclty and watch for the items in question, or you could filter them based upon a common parent – in your case the fieldset. Example:

    $("#form").validate({
        /* */
        errorPlacement: function(error, element)
        {
            if( element.closest("#subFieldSet").length ) {
                /* special handling */
            } else {
                /* generic handling */
                error.insertAfter(element);
            }
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 290k
  • Answers 290k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Have you switched it off accidentally? In the options dialog… May 13, 2026 at 5:47 pm
  • Editorial Team
    Editorial Team added an answer try this: string GetString<T>(List<T> list) where T : IEntityCore {...}… May 13, 2026 at 5:47 pm
  • Editorial Team
    Editorial Team added an answer The 'responsibility' is defined in this principle as a reason… May 13, 2026 at 5:47 pm

Related Questions

I have a form that uses the excellent jQuery validation plugin. This is a
I am developing a WordPress page that uses a jquery.slideto.js navigation system and html
I'm playing around with writing a jQuery plugin that uses an attribute to define
We have developed a website that uses MVC, C#, and jQuery. In one of
The basics: I have a contact form that uses php to validate the forms.

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.