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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T12:44:41+00:00 2026-06-16T12:44:41+00:00

This is a followup to another question; First I needed to get the validation

  • 0

This is a followup to another question; First I needed to get the validation working on a normal select list. (The first part is available here)

I have a select menu that has some jQuery Validation logic on it. I am using ASP.NET MVC, so there are some custom attributes – but right now I just want the validation to work, so the attributes are not important.

I managed to get that to work (actually, Gajotres solved it, not me.)

Now I want to extend it into the jQuery UI selectmenu plug (plugin is still unofficial – slated for official release in the next version of jQuery UI, but you can find it here : jQuery UI Select Menu (Unofficial)

I have managed to get the styling to work, but now validation fails again. I am posting my code, and a fiddle here. Please note there is more than the code posted here, just for brevity.

jsFiddle (with Plugin)

jsFiddle (without Plugin [properly working])


Expected Behavior

The user must not be able to submit the form while the “Default” option is the currently selected value in the select menu.


Here is a link to all relevant files in case you just don’t want to try the fiddle for some reason.

jQuery

  • http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css
  • http://code.jquery.com/ui/1.9.2/jquery-ui.js

jQuery Validation Plugin

  • http://ajax.aspnetcdn.com/ajax/jquery.validate/1.10.0/jquery.validate.js

Select Menu (forked)

  • http://ciel.github.com/jquery-ui/javascripts/jquery.ui.selectmenu.js
  • http://ciel.github.com/jquery-ui/stylesheets/selectmenu.css

Javascript

$(document).ready(function() { 

    $.validator.addMethod("valueNotEquals", function(value, element, arg){
        return arg != value;
    }, "");

    $("#form1").validate({
        rules: {
            select_list : {valueNotEquals: $('#select_list').attr('data-val-mustbe-propertyvalue')},  
        },
        messages: {  
            select_list : { valueNotEquals: $('#select_list').attr('data-val-required') }
        },        
        submitHandler: function(form) {
            alert($('#form1').valid());
            form.submit();
        }
    });

    $("#select_list").selectmenu();
});​

HTML

<form id="form1" action="">
    <select id="select_list" name="select_list">
            <option value="default">Choose...</option>
            <option value="1">1</option>
            <option value="2">2</option>
    </select>
    <input type="submit" id="submit" value="Submit" />
</form>​

CSS

        body {
            font-size: 62.5%;
            font-family: "Verdana",sans-serif;
        }

        fieldset {
            border: 0;
        }

        label, select, .ui-select-menu {
            float: left;
            margin-right: 10px;
        }

        select {
            width: 200px;
        }

        .wrap ul.ui-selectmenu-menu-popup li a {
            font-weight: bold;
}

​Additional CSS to theme the select menu is found in the selectmenu.css file, available here

  • http://ciel.github.com/jquery-ui/stylesheets/selectmenu.css
  • 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-06-16T12:44:42+00:00Added an answer on June 16, 2026 at 12:44 pm

    I know what is a problem with your new implementation. I got the same problem myself.

    Validate plugin can not validate elements with css display: none. And for this plugin to work original select must be hidden below the custom one.

    Here’s an example I made to demonstrate this:

    http://jsfiddle.net/Gajotres/64aKZ/

    You should comment/uncomment this css bloc to se the difference:

        #select_list {
             display: block !important;
        }
    

    Now from what I could see this plugin was not created to cover the old select box (no matter if original display was block or none). If you don’t mind take a look at a plugin I am suing. It will cover old select box even if its display is set to block:

    http://jamielottering.github.com/DropKick/

    EDIT :

    There’s another solution. You will need to play with css. Set this to select box:

        #select_list {
             display: block !important;
             visibility: hidden;
        }
    

    Now you will need to cover old select box with new one, or at least float new one to the left.

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

Sidebar

Related Questions

This is a followup to my earlier question : SELECT s.unique_id, s.counter, s.sequence_length, s.yearmonth,
This is a followup/post question to another question; as I have discovered a solution
This is a follow up to another question of mine where I first found
This is a followup to another question I asked abou creating your own hooks.
This is a followup to another question I asked earlier ( Earlier redirect question
This is a followup question to another question I asked earlier. I thought I
This is a followup to this question. Here's the code I'm trying to understand
This is a followup to the question I asked here: Class Hierarchy - Data
This is a follow up to another question of mine. The solution I found
This is a followup from here . I am trying to reload a pdf

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.