json-editor icon indicating copy to clipboard operation
json-editor copied to clipboard

Allow new value in enum : select2 tags like

Open anaisforat opened this issue 8 years ago • 1 comments

Hello,

I would like to have something like that "tags" options in select2.

This means, the user can select from pre-existing options (defined in my "enum") or create a new tag by picking the first choice, which is what the user has typed into the search box so far.

But I can't figure out how to do this, is there a way ?

Here is my json: "Organization": { "type": "array", "format": "select", "items": { "type": "string", "enum": [ "Organization 1", "Organization 2", "Organization 3" ] }, "uniqueItems": true, "predefinedtype": "Organization", "title": "Organization" }

This json makes me a nice select2 box with multiple choice allowed, but it won't let me add a custom choice.

I tried to had: "options": { "select2_options": {"tags": true} }

But then I get an error : Option 'tags' is not allowed for Select2 when attached to a < select > element.

Hope it's clear !

Thanks.

anaisforat avatar Aug 20 '15 14:08 anaisforat

got same issue with no resolution yet lol.. You found a fix?

Pluggr avatar May 15 '22 21:05 Pluggr