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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T15:01:33+00:00 2026-05-20T15:01:33+00:00

On our site we are using an embedded sign-up form from our ESP that

  • 0

On our site we are using an embedded sign-up form from our ESP that uses the jQuery validate plugin. We are customizing the form a bit, adding a couple of custom fields (first name, last name) and we want them to be grouped so there is only one error message for both the fields.

Since the form’s validator has already been initialized I need to add in a few things dynamically. The plugin provides the rules( “add”, rules ) method to add in validation rules dynamically, although we are just using class names to do this anyhow. But there is no clear way to set the groups option after the validator has been initialized.

I’ve tried a few different things to accomplish this, but none some to be working:

var settings = $("#mc-embedded-subscribe-form").validate().settings;
$("#mc-embedded-subscribe-form").validate($.extend(settings, {
    groups: {
        username: "FNAME LNAME"
    },
    errorPlacement: function(error, element) {
        if (element.attr("name") == "FNAME" || element.attr("name") == "LNAME") {
            error.insertAfter("#username_group");
        } else {
            error.insertAfter(element);
        }
    }
}));

The errorPlacement function is added to the validator, but not the groups.

I’ve also tried setting the groups option explicitly, but that has no effect either.

$("#mc-embedded-subscribe-form").validate().settings.groups = { username: "FNAME LNAME" };
$("#mc-embedded-subscribe-form").validate().groups = { username: "FNAME LNAME" };

I’m completely stumped as how to accomplish this.

  • 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-20T15:01:34+00:00Added an answer on May 20, 2026 at 3:01 pm

    I was looking for a way to do this too and found a solution in the jQuery help forum: http://forum.jquery.com/topic/jquery-validate-defining-groups-dynamically

    var getGroups = function() {
        var result = {};
        $('#myTable tr').each(function(i) {
            var field1Name = $(this).find('.field1').attr('name');
            if (field1Name != undefined) {
                var field2Name = $(this).find('.field2').attr('name');
                result['fieldPair_' + i] = field1Name + ' ' + field2Name;
            }
        });
        return result;
    }
    
    $('#myForm').validate({  groups: getGroups() });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the JQuery scrollTo plugin on our one-page site to vertically scroll between
We are using Google Analytics for our site, but since it uses client script
I'm looking at using less . js (looks great), but our site requires that
For our site, Im using a lot of jQuery - right now Im looking
We're intergrating our site with an external site using form posts. The form on
I am using the JQuery UI Accordion. We have to make our site 508
We are trying to pass credentials to our site via jquery ajax (not using
I tried backing up our site today using the Unix 'cp' command and ended
I am using Lemonstand (an e-commerce CMS) and after going live with our site
We're using silverlight on our SharePoint site. When someone navigates to the page containing

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.