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

  • Home
  • SEARCH
  • 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 4070144
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T16:35:24+00:00 2026-05-20T16:35:24+00:00

I have a form that has an attached map. Clicking on the map adds

  • 0

I have a form that has an attached map. Clicking on the map adds hidden inputs to a div in the form.

I want a validation rule to check whether or not that div has any hidden elements. So far, I’ve only been able to do this with a dummy element that I have to manually remove before posting the form:

<form action="..." method="post" id="signup">
  <!-- ... -->
  <div id="zones_selected"><input type="hidden" name="dummy"></div>
  <!-- ... -->
</form>

$.validator.methods.zones = function (value, element, param) { return ($zone_holder.find('input[name!=dummy]').length > 0); };
$('#signup').validate({
  rules: {
    //...
    'dummy': 'zones'
  },
  //...
  submitHandler: function(form) { $(form).find('input[name=dummy]').remove(); form.submit(); }
});

However, these leaves much to be desired for error placement, as my custom validator method doesn’t seem to ever trigger the unhighlight function, and I feel dirty for having put in an input solely for form validation (not very unobtrusive).

What I would like is no extra submitHandler and a rule to check the presence of hidden inputs in a div that would have an unhighlight trigger (such that if a user does click on the map–which creates a new hidden input–the message I display telling them to do so will disappear).

What’s the best way 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-20T16:35:25+00:00Added an answer on May 20, 2026 at 4:35 pm

    I’ve tried to do this in the past. I don’t believe there is a way to do it without doing some modifications to the jquery.validator code base.

    When looking at JQuery.Validator.js, check out ‘elements’ function on ln 423 you’ll see something like this

    return $([]).add(this.currentForm.elements)
                .filter(":input")
                .not(":submit, :reset, :image, [disabled]")
                .not( this.settings.ignore )
                .filter(function() {
                    !this.name && validator.settings.debug && window.console && console.error( "%o has no name assigned", this);
    
                    // select only the first element for each name, and only those with rules specified
                    if ( this.name in rulesCache || !validator.objectLength($(this).rules()) )
                        return false;
    
                    rulesCache[this.name] = true;
                    return true;
                });
    

    The filter(“:input”) is what will give you grief.

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

Sidebar

Related Questions

If I have a form element that has multiple validators attached to it (3
I have a form that has multiple fields, and for testing purposes is there
I have a form that has a public property public bool cancelSearch = false;
I have a form that has a few similar controls and the parent contains
I have a web form that has multiple ListBoxes, TextBoxes, DropDowns. If I put
I have a form in C# that has a button that, when clicked, I
If I have a form-backing object that has a complicated object tree -- say
I have a form that is dynamically generated, and has dynamically generated id's (and
I have a site that has a simple HTML button in a form. All
I have an Access form where each record has some info that is computed

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.