Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I disable the Selectmenu Widget for specific fields? #263

Closed
ChayaCooper opened this issue Aug 28, 2012 · 7 comments
Closed

How can I disable the Selectmenu Widget for specific fields? #263

ChayaCooper opened this issue Aug 28, 2012 · 7 comments

Comments

@ChayaCooper
Copy link

The Selectmenu Widget is creating duplicates of Multiselect fields. Is there a way to disable the Selectmenu Widget for specific Select fields (as opposed to the entire form)?

@fnagel
Copy link
Owner

fnagel commented Aug 30, 2012

What exactly do you mean with Multiselect? The Selecmenu Widget does not support multiselect feature.

I'm not quite sure if I understand you right, but I will try :-)
You have a form with a few native selects but you want only specific to be replaced by Selectmenu Widget, right?

A demo fiddle (see #61) or a link would be helpful!

@ChayaCooper
Copy link
Author

I have a lot of native Selects and a few MultiSelects (I'm using another plugin for those).

I'd like to replace all the native Selects with the Selectmenu Widget, and disable it for all multiselects or disable specific ones (either by class or individually). Doing it this way would be a lot more efficient and create less room for mistakes by another developer.

Can that be done? If not, how would I specify which native Selects should be replaced by the Selectmenu Widget?

@fnagel
Copy link
Owner

fnagel commented Aug 30, 2012

Yes, thats pretty easy. Just call the Selectmenu widget on those selects you need.

That can be done by any jQuery selector. Are you familiar with the concept of jQuery selectors?
Example: add a CSS class to all non-multi selects and use $(".yourCssClass").selectmenu() or use a jQuery selector which does no select multiselects (google for it!).

@ChayaCooper
Copy link
Author

I was hoping it would be an easy question ;-)

I haven't used jQuery selectors before, but thanks to StackOverflow I found the correct selectors :)

$("select#categories:not([multiple])") // with single only $("select#categories[multiple]") // with multiple

I couldn't find a set of easy-to-follow instructions to show me how to use it though, and $("select#categories:not([multiple])").selectmenu(); didn't work :-( Would you be able to show me where to insert it?

@fnagel
Copy link
Owner

fnagel commented Aug 30, 2012

Hey Chaya,

here is a demo fiddle: http://jsfiddle.net/GXtpC/591/

@ChayaCooper
Copy link
Author

That's easy :-D Thank you so much!

@fnagel
Copy link
Owner

fnagel commented Sep 3, 2012

Your're welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants