plone / plone.formwidget.autocomplete

z3c.form widget for Plone using jQuery Autocomplete
https://pypi.org/project/plone.formwidget.autocomplete
2 stars 12 forks source link

question: QuerySourceCheckboxWidget subform behavior #26

Open ewohnlich opened 4 years ago

ewohnlich commented 4 years ago

I am trying to implement this widget and getting some odd behavior in Plone 5.2 that appears to be because of how QuerySourceCheckboxWidget (from which this widget inherits) is built.

My setup is a standard 5.x Plone form that inherits from plone.autoform.form.AutoExtensibleForm and z3c.form.form and uses a zope schema.

directives.widget(authors_all_names=AutocompleteMultiFieldWidget)
authors_all_names = schema.List(
    title=_("Author"),
    required=False,
    value_type=schema.Choice(source=AuthorSource())
)

The view template displays the rendered form as well some search results. Before the form is submitted the behavior works as expected. After a search is performed, the rendered form includes a "search" button on the field's fieldControls section and typing in the input box no longer prompts any js. The "search" button seems to be coming from QuerySubForm.

This behavior is so odd that I assume I either implemented something wrong or this widget is not meant to be used in cases where the value is set from request data.