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 6638471
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:26:23+00:00 2026-05-25T23:26:23+00:00

I’m using jquery validate and I’ve set up groups. However, I’m having trouble figuring

  • 0

I’m using jquery validate and I’ve set up groups. However, I’m having trouble figuring out the best way to validate each group seperately from the individual fields that it contains.

To illustrate this:

I have city, state, and zip ( in that order ). If someone enters a value for zip, they should get positive confirmation ( I’ve got that part working with a green checkmark by the input ), however, so long as either state and zip are empty the group validation message should still show.

On various attempts I’ve come up to the following problems:
– User skips over “city” and the validation the message displays but then when input is provided for “zip”, the validation message goes away. ( this is weird…maybe a bug? )
– User enters “city” and they get the group error message before they even get to enter “state”
– User enters “city” but won’t get the checkmark because the other inputs in the group are empty

I’m leaning towards addressing this by overwriting the “onfocusout” event ( by having it check all the inputs in the group on focusout ) but not sure if there is a better way via some of validate’s built in methods

Thanks!

*UPDATE

The solutions I’ve come up with are rather ugly and none of them work consistently, below is an example, it results in the inverse of the first problem I listed above. Now the validation message only shows when the last field in a group is filled in.

Maybe group validation rely’s on the validation result of the last test in a group?

Anyway…here’s the mess I’ve come up with so far:

Set the group:

groups : { location : 'city state zip' }

Create a rule for the group ( note it has to be an array to preserve the order ):

rules : { location : ['city, 'state', 'zip']}

Now override the onfocusout:

    onfocusout : function(el) {
        var groups = this.groups
            , elName = el.name
            , elGroup = groups[elName]
            , $el = $(el)

        if (!this.checkable(el) ){
            this.element(el));
        }

        // If the element belongs to a group, validate all elements in the group 
        // that come before the current element
        if (elGroup) {
            var groupMembers = this.settings.rules[elGroup];

            for (var i=0; i<groupMembers.length; i++) {
                if ( groupMembers[i] === elName ) {
                    break;
                }
                this.element( $('[name="' + groupMembers[i] + '"]') );
            }
        }
    }
  • 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-25T23:26:23+00:00Added an answer on May 25, 2026 at 11:26 pm

    It seems the “groups” feature of this plugin has a few issues that are still outstanding, a few of which look to be related to your problem.

    https://github.com/jzaefferer/jquery-validation/issues/search?q=groups

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am reading a book about Javascript and jQuery and using one of the
We're building an app, our first using Rails 3, and we're having to build
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

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.