The plugins site is currently in development.
We've been looking to provide a higher-quality, spam-free experience at the plugins site for some time, and a major error on our part forced us to shut down the current site before we could put the new one in place. We are developing a new site, and you can follow along with its development on GitHub. For more information about this transition, including steps you can take as a plugin author to prepare, please read our post about what's going on.
If "form" is not parent. Plugin won't work.
| Project: | ComboSelect |
| Version: | 1.0.0 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
If the select box is not a direct child of the form or in other words the select box parent is not a form then the plugin won't work. It can't append the options to the form and it can't use the handler.
Eg..
var theForm = $(this).parent('form');<script>
$('#myselect').comboselect({ sort: 'both', addbtn: '+', rembtn: '-' });
</script>
<form>
<div>
<select id="myselect" multiple="multiple" name="myselect">
<option value="foo">foo</option>
</select>
</div>
</form>I have hacked around the plugin to take an extra option called "parentformid" which is the forms id. This way you can set "theForm" like so:
var theForm = $('#'+settings.parentformid);This then lets the select box be anywhere within the form. I'm sure there are better ways of doing this but this was the quickest way of fixing it.
- Login to post comments

Comments
#1
That hack is not needed. There simply is a small mistake in the plugin at line 42:
var theForm = $(this).parent('form');this should become:
var theForm = $(this).parents('form');'parent' only searches up 1 level, 'parents' goes all the way :-)