Multi select dropdown in plugin settings?
-
Thanks @psychobunny
<div class="form-group col-xs-12"> <label for="categories">Category</label> <select multiple class="form-control" name="categories" title="Categories"> <option value="">Select a category</option> <option value="1">Announcements</option> <option value="2">General Discussion</option> <option value="4">Comments & Feedback</option> <option value="3">Blogs</option> </select> </div>
-
This plugin works for me:
Settings.registerPlugin({ Settings: {}, types: ['selectMultiple'], use: function () { Settings = this; }, set: function (element, value) { if (value.constructor === Array) { for (var val in value) { element.find('option[value=val]').attr("selected",true); } } }, get: function (element, trim, empty) { var value = []; element.find('option:selected').each(function () { value.push($(this).val()); }); return value; } });
With data-type="selectMultiple" added to the select tag.
-
You may need to clear cache?
fixed #2657 -- there's a slight chance this might break other ACP pag… · NodeBB/NodeBB@d096a63
Node.js based forum software built for the modern web - fixed #2657 -- there's a slight chance this might break other ACP pag… · NodeBB/NodeBB@d096a63
GitHub (github.com)
Copyright © 2024 NodeBB | Contributors