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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:33:18+00:00 2026-05-27T20:33:18+00:00

So the situation is this: attempting to add a dropdown box using the jquery.multiselect

  • 0

So the situation is this: attempting to add a dropdown box using the jquery.multiselect plugin on a form that current uses the jquery.validate plugin that has other fields (text input fields, single text input that has a float value range) that all currently validate correctly.

When I attempt to add validation rules I simply cannot get jquery.validate to validate my multiselect dropdown whatsoever. Here are snippets of my code (all assumes that required plugins are loaded – see below for versions used):

The HTML:

<form action="some/action" id="myForm" method="POST">
    Input 1: <input type="text" value="" name="input1" maxlength="200" id="input1"><br/>
    Input 2: <input type="text" value="" name="input2" maxlength="100" id="input2"><br/>
    Input 3: <input type="text" value="" name="input3" maxlength="50" id="input3"><br/>
    Select: <select class="someSelect" name="mySelect" id="mySelect" multiple="multiple">
        <option value="some_val1">Some Value</option>
        <option value="some_val2">Some Other Value</option>
    </select>
    <input type="submit" value="Submit" />
</form>

The Javascript:

$(document).ready(function() {
    $('#mySelect').multiselect({
        noneSelectedText: 'Select Something (required)',
        selectedList: 3,
        classes: 'my-select'
    });

    $.validator.addMethod("needsSelection", function(value, element) {
        return $(element).multiselect("getChecked").length > 0;
    });

    $.validator.addMethod("isPercent", function(value, element) {
        return parseFloat(value) >= 0 && parseFloat(value) <= 100;
    });

    $.validator.messages.needsSelection = 'You gotta pick something.';
    $.validator.messages.isPercent = 'Must be between 0% and 100%';

    $('#myForm').validate({
        rules: {
            mySelect: "required needsSelection",
            input1: "required isPercent",
            input2: "required",
            input3: "required"
        },
        errorClass: 'invalid'
    });
});

Versions
If there’s an explicit/known issue with compatibility between the versions, then I may upgrade if that solves the issue, but I’ve tested using the newest versions for my purposes and it did not seem to solve my issue.

jQuery: 1.4.4

jquery.validate: 1.9.0

jquery.multiselect: 1.8

And, as always, I can provide more information where possible/needed.

  • 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-27T20:33:19+00:00Added an answer on May 27, 2026 at 8:33 pm

    So it seems that the rules I was setting up for the multiselect were indeed being attached to the select, however, since the original select box is :hidden by jquery.multiselect, jquery.validate by default ignores any hidden inputs.

    The solution (which is not of my own – a coworker found it) is to use the ignore settings for jquery.validate. Whatever selector is passed in with the ignore setting is put into a jquery .not(), so the solution is actually to use a double negative here:

    $('#myForm').validate({
        rules: {
            mySelect: "required needsSelection",
            input1: "required isPercent",
            input2: "required",
            input3: "required"
        },
        ignore: ':hidden:not("#mySelect")', //Tells it to check the hidden select
        errorClass: 'invalid'
    });
    

    Phew!

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

Sidebar

Related Questions

The Situation (Ignore this it is boring): I have reports that I created using
The situation is this: You have a Hibernate context with an object graph that
I'm attempting to write a particular script that logs into a website. This specific
I've got a web service (ASP.NET 2.0) that I'm calling from javascript using jQuery's
Using LDAP is checking a username/password as simple as attempting to bind as that
I ran across this situation this afternoon, so I thought I'd ask what you
In this situation I am trying to perform a data import from an XML
This situation arises from someone wanting to create their own pages in their web
In this situation I have two models, Comment and Score. The relationship is defined
Look at this situation: www.websitea.com displays an img tag with a src attribute of

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.