Bootstrap 3 - Multi Select Validation

I'm trying to add the "required" attribute to my select, but doesn't seem to work.  

I see the error:
An invalid form control with name='companyGoalST[]' is not focusable.

Fiddle: https://jsfiddle.net/gallitin/8e661v4p/2/

My HTML:
<form action="#" method="post">
<select id="stGoal" class="form-control" name="companyGoalST[]" required multiple="multiple">
    <option value="1">Build a CRM database</option>
    <option value="2">Generate awareness</option>
    <option value="3">Grow my followers</option>
    <option value="11">Educate consumers</option>
    <option value="12">Retain existing customers</option>
    <option value="13">Increase sales</option>
</select>
    <input type="submit" value="submit"/>
</form>

Open in new window


jQuery:
$(document).ready(function() {
        $('#stGoal').multiselect({
            nonSelectedText: 'Select Goal',
    		buttonWidth: '100%',
            onChange: function(option, checked) {
                // Get selected options.
                var selectedOptions = $('#stGoal option:selected');
 
                if (selectedOptions.length >= 2) {
                    // Disable all other checkboxes.
                    var nonSelectedOptions = $('#stGoal option').filter(function() {
                        return !$(this).is(':selected');
                    });
 
                    var dropdown = $('#stGoal').siblings('.multiselect-container');
                    nonSelectedOptions.each(function() {
                        var input = $('input[value="' + $(this).val() + '"]');
                        input.prop('disabled', true);
                        input.parent('li').addClass('disabled');
                    });
                }
                else {
                    // Enable all checkboxes.
                    var dropdown = $('#stGoal').siblings('.multiselect-container');
                    $('#stGoal option').each(function() {
                        var input = $('input[value="' + $(this).val() + '"]');
                        input.prop('disabled', false);
                        input.parent('li').addClass('disabled');
                    });
                }
            }
        });
    });

Open in new window

LVL 12
Nathan RileyFounderAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rainer JeschorCommented:
Hi,

which browser version? I could not reproduce the message neither in Firefox 42 nor IE11.
Thanks
Rainer
Nathan RileyFounderAuthor Commented:
I'm in google chrome.
Rainer JeschorCommented:
Hi,
that is a "feature" of Chrome.
The problem is, that the required select field is internally hidden by the bootstrap multi-select. But Chrome tries to focus on the required element which is not possible - hence the error message (solely in Chrome).

HTH
Rainer

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

Nathan RileyFounderAuthor Commented:
Ok, thanks.  How can I work around this issue then?
sajayj2009Commented:
Which chrome version?
I see good in version 46.
Nathan RileyFounderAuthor Commented:
Version 46.0.2490.86 m
 
Google Chrome is up to date.
sajayj2009Commented:
Works fine, Maybe browser cache issue...
Nathan RileyFounderAuthor Commented:
https://jsfiddle.net/gallitin/8e661v4p/2/

On that fiddle, you're telling me when you hit submit without anything selected you get a this field is required popup?  I don't I get a jquery error in console as per above.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
jQuery

From novice to tech pro — start learning today.