SelectWiget with JSON vocabulary source (SelectizeJS) or how to deal with large vocabularies?

I have this schema with a (multi) select

    form.widget("gl_primary_author", SelectWidget)
    gl_primary_author = schema.Choice(
        title=_("Primary author"),
        description=_("Primary author"),

We have some special requirements within the edit form: drag&support and searching which is accomplished using the SelectizeJS module.

However, the number of list items became larger and larger and we have several of such fields in the edit field of a particular content-type.

I can pass a JSON URL to SelectizeJS for fetching the vocabulary values from Plone...also working.

Problem and question: keeping the existing source as specified above conflicts with the JSON URL configuration of Plone.

Replacing source=Authors(with_empty=True) with an empty vocabulary=SimpleVocabulary([]) avoid rendering of the list entries from the Plone side however I can no longer save data back into Plone since the value to be stored does not exist in the empty vocabulary.

There is reasonable approach?

I'd try to replace SelectWidget with something that doesn't try to render all values.
Then you can keep source=Authors(...).

Alternatively you could make a SimpleVocabulary subclass that will implement something to make the validation pass. I guess __getitem__?

We use this for a fairly custom approach with autocomplete

drugName = schema.Choice(
    title=_(u"prescription_label_treatment", default=u"Prescribed drug"),
    description=_(u'Write drug name like mtx, inf, ada ... '),

Plone Foundation Code of Conduct