Plugins

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
Description

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.

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

#1

Version:1.0.1» 1.0.0

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 :-)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.