thanks for your reply @tmassman. the pattern of the subject field is more or less simliar to list_field_voc_unconstrained
from the example above.
drawback: it uses a schema.Tuple / schema.List field so the resulting attribute will be an iterable instead of str
i also tried something like this in the meantime
- form renders
- widget allows vocab values and custom input
- BUT widget is multiselect and i can't figure out how to stop it to allow mutiple values
- i use a predefined vocab in the example below because i previously had troubles to get ajaxselectfield working with custom searchable vocabs / sources (errors similar to the ones reported in this thread)
widget(
"city",
AjaxSelectFieldWidget,
vocabulary="plone.app.vocabularies.Users",
pattern_options={
"maximumSelectionLength": 1, # does not affect multiselect
"multiple": False, # neither
},
)
city = schema.TextLine(
title="City",
required=False,
)