plone / plone.formwidget.autocomplete Goto Github PK
View Code? Open in Web Editor NEWz3c.form widget for Plone using jQuery Autocomplete
Home Page: https://pypi.org/project/plone.formwidget.autocomplete
z3c.form widget for Plone using jQuery Autocomplete
Home Page: https://pypi.org/project/plone.formwidget.autocomplete
Possibly related to plone.app.multilingual; at least I only tested it there. Tired of bug hunting now, but let me at least put down some notes.
Setup scenario:
Now the problem:
A. Use the browse button (contenttree widget) to select the second page, see that a radio button is added in the original form showing the selected page, and submit the form and all is well: the two documents are now related.
B. Instead use the autocomplete input to select the second page, see that a radio button is added in the original form showing the selected page, and submit the form and all is not well: no relation has been added.
I have checked, and the radio button that is added in both these cases is exactly the same, in my case:
<input type="radio" checked="checked" name="form.widgets.content" id="form-widgets-content-0" title="None" value="/Plone/nl/soon-to-be-english-page-created-in-dutch-site" class="contenttree-widget required relationchoice-field">
So somehow the autocomplete widget does not correctly save the value.
Provided plone.formwidget.autocomplete.widget.AutocompleteMultiFieldWidget
does fail to validate required field.
I wanted to create a RelationList field with at least one related item. Possible the easiest way to reproduce is to:
plone.app.relationfield.behavior.IRelatedItems
behavior enabled.plone.app.relationfield.behavior.py
and:
relatedItems
field to required=True
AutocompleteMultiFieldWidget
in the schema to relatedItems
field with plone.autoform.directives
What happens:
It is possible to create a new "dummy" content with no related items at all.
Expected behavior:
Not be able to create "dummy" unless there is at least one related items set.
Note:
Maybe the problem is much deeper, since I'm able to create the "dummy" without step 2. I'm also not getting validation error if I go TTW:
This commit in 1.2.5 onwards uses JQuery.prop(), which is only introduced in JQuery 1.6.
Obviously this won't work in Plone 4.2 as it ships with JQuery 1.4 (pins plone.app.jquery 1.4.4).
This product should have (IMO) been bumped up a major version when this major incompatibility was introduced. But maybe we should revert back to using attr()?
This was discovered whilst working out why plone.app.multilingual tests weren't passing in 4.2
please define JS resources after collective.js.jqueryui.custom.min.js
in order to ensure sane resource delivery.
On plone6
(like plone/five.intid#15)
The current implementation of the widget makes it under some situations sluggish and unresponsive in particular with slow backend responses or fast typing.
The widget already uses jquery.autocomplete.js which has optional support for using ajaxQueue which would allow to abort a pending ajax request in favor of a more up-to-date query request.
So an improved usability might be accomplished by shipping the widget with ajaxQueue.
Form field radio button inputs are rendered without :list on the name (apart from the 'novalue' option on non required fields but that is a separate issue with z3c.formwidget).
New options added via js should therefore not have :list added to the name.
The name attributes of the inputs do not match so you cannot deselect the original value.
When utilizing the JavaScript AJAX call to a vocabulary that is sensitive to a logged in user's permissions (i.e. a vocabulary whose terms are based on catalog searches to ACL-restricted content), the AJAX call fails due to LookupError (my code). When researching the issue, I found that the request context is the Anonymous user instead of the user that is actually logged in.
The widget works fine (as expected) when not using JavaScript. Here's the URL that is causing the issue
Why, when going to this view, would my logged in user become 'Anonymous' instead of what they actually are authenticated as?
Hi,
can you release this package please ?
Thanks !
Thomas
I`m confused whether plone.formwidget.autocomplete has Plone6 support or not. At setup.py classifier "Framework :: Plone :: 6.0" is set. But after installation I see an error message:
2023-03-15 14:42:43,204 ERROR [Products.CMFPlone.resources.browser.resource:155][waitress-0] Bundle 'formwidget-autocomplete' has a non existing dependency on 'jquery'. Bundle ignored - This may break your site!
Am I missing something?
I get the following error, if i try to setup AutocompleteSelectionWidget for a RelationChoice field.
It seems related to:
Maybe we need to fix that Widget too, see:
Traceback (innermost last):
Module ZPublisher.Publish, line 138, in publish
Module ZPublisher.mapply, line 77, in mapply
Module ZPublisher.Publish, line 48, in call_object
Module plone.z3cform.layout, line 66, in __call__
Module plone.z3cform.layout, line 60, in update
Module z3c.form.form, line 161, in render
Module zope.browserpage.viewpagetemplatefile, line 51, in __call__
Module zope.pagetemplate.pagetemplate, line 132, in pt_render
Module zope.pagetemplate.pagetemplate, line 240, in __call__
Module zope.tal.talinterpreter, line 271, in __call__
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 888, in do_useMacro
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 533, in do_optTag_tal
Module zope.tal.talinterpreter, line 518, in do_optTag
Module zope.tal.talinterpreter, line 513, in no_tag
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 954, in do_defineSlot
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 533, in do_optTag_tal
Module zope.tal.talinterpreter, line 518, in do_optTag
Module zope.tal.talinterpreter, line 513, in no_tag
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 858, in do_defineMacro
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 533, in do_optTag_tal
Module zope.tal.talinterpreter, line 518, in do_optTag
Module zope.tal.talinterpreter, line 513, in no_tag
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 852, in do_condition
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 821, in do_loop_tal
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 533, in do_optTag_tal
Module zope.tal.talinterpreter, line 518, in do_optTag
Module zope.tal.talinterpreter, line 513, in no_tag
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 533, in do_optTag_tal
Module zope.tal.talinterpreter, line 518, in do_optTag
Module zope.tal.talinterpreter, line 513, in no_tag
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 888, in do_useMacro
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 533, in do_optTag_tal
Module zope.tal.talinterpreter, line 518, in do_optTag
Module zope.tal.talinterpreter, line 513, in no_tag
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 821, in do_loop_tal
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 533, in do_optTag_tal
Module zope.tal.talinterpreter, line 518, in do_optTag
Module zope.tal.talinterpreter, line 513, in no_tag
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 954, in do_defineSlot
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 533, in do_optTag_tal
Module zope.tal.talinterpreter, line 518, in do_optTag
Module zope.tal.talinterpreter, line 513, in no_tag
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 858, in do_defineMacro
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 533, in do_optTag_tal
Module zope.tal.talinterpreter, line 518, in do_optTag
Module zope.tal.talinterpreter, line 513, in no_tag
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 531, in do_optTag_tal
Module zope.tal.talinterpreter, line 513, in no_tag
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 742, in do_insertStructure_tal
Module zope.tales.tales, line 696, in evaluate
- URL: /home/maik/develop/plone/.buildout/eggs/plone.app.z3cform-0.7.7-py2.7.egg/plone/app/z3cform/templates/macros.pt
- Line 97, Column 46
- Expression: <PathExpr standard:u'widget/@@ploneform-render-widget'>
- Names:
{'args': (),
'context': <Library at /ub/ub-db/1>,
'default': <object object at 0xb75116d0>,
'loop': {},
'nothing': None,
'options': {},
'repeat': {},
'request': <HTTPRequest, URL=http://localhost:8080/ub/ub-db/1/@@edit>,
'template': <zope.browserpage.viewpagetemplatefile.ViewPageTemplateFile object at 0xb47c0dec>,
'view': <plone.dexterity.browser.edit.DefaultEditForm object at 0xb148b58c>,
'views': <zope.browserpage.viewpagetemplatefile.ViewMapper object at 0xb14b50cc>}
Module zope.tales.expressions, line 217, in __call__
Module Products.PageTemplates.Expressions, line 155, in _eval
Module Products.PageTemplates.Expressions, line 117, in render
Module Products.Five.browser.metaconfigure, line 479, in __call__
Module zope.browserpage.viewpagetemplatefile, line 83, in __call__
Module zope.browserpage.viewpagetemplatefile, line 51, in __call__
Module zope.pagetemplate.pagetemplate, line 132, in pt_render
Module zope.pagetemplate.pagetemplate, line 240, in __call__
Module zope.tal.talinterpreter, line 271, in __call__
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 858, in do_defineMacro
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 954, in do_defineSlot
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 531, in do_optTag_tal
Module zope.tal.talinterpreter, line 513, in no_tag
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 742, in do_insertStructure_tal
Module zope.tales.tales, line 696, in evaluate
- URL: /home/maik/develop/plone/.buildout/eggs/plone.app.z3cform-0.7.7-py2.7.egg/plone/app/z3cform/templates/widget.pt
- Line 37, Column 4
- Expression: <PathExpr standard:u'widget/render'>
- Names:
{'args': (),
'context': <AutocompleteSelectionWidget 'form.widgets.integrated_in'>,
'default': <object object at 0xb75116d0>,
'loop': {},
'nothing': None,
'options': {},
'repeat': {},
'request': <HTTPRequest, URL=http://localhost:8080/ub/ub-db/1/@@edit>,
'template': <zope.browserpage.viewpagetemplatefile.ViewPageTemplateFile object at 0xb4a4974c>,
'view': <Products.Five.metaclass.RenderWidget object at 0xb148bdcc>,
'views': <zope.browserpage.viewpagetemplatefile.ViewMapper object at 0xb148bf4c>}
Module zope.tales.expressions, line 217, in __call__
Module zope.tales.expressions, line 211, in _eval
Module plone.formwidget.autocomplete.widget, line 124, in render
Module Products.Five.browser.pagetemplatefile, line 125, in __call__
Module Products.Five.browser.pagetemplatefile, line 59, in __call__
Module zope.pagetemplate.pagetemplate, line 132, in pt_render
Module zope.pagetemplate.pagetemplate, line 240, in __call__
Module zope.tal.talinterpreter, line 271, in __call__
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 742, in do_insertStructure_tal
Module Products.PageTemplates.Expressions, line 218, in evaluateStructure
Module zope.tales.tales, line 696, in evaluate
- URL: /home/maik/develop/plone/.buildout/eggs/plone.formwidget.autocomplete-1.2.7-py2.7.egg/plone/formwidget/autocomplete/input.pt
- Line 3, Column 4
- Expression: <PathExpr standard:u'view/renderQueryWidget'>
- Names:
{'args': (<AutocompleteSelectionWidget 'form.widgets.integrated_in'>,),
'container': <Library at /ub/ub-db/1>,
'context': <Library at /ub/ub-db/1>,
'default': <object object at 0xb75116d0>,
'here': <Library at /ub/ub-db/1>,
'loop': {},
'nothing': None,
'options': {},
'repeat': <Products.PageTemplates.Expressions.SafeMapping object at 0xb13995a4>,
'request': <HTTPRequest, URL=http://localhost:8080/ub/ub-db/1/@@edit>,
'root': <Application at >,
'template': <Products.Five.browser.pagetemplatefile.ViewPageTemplateFile object at 0xb4d730ec>,
'traverse_subpath': [],
'user': <PropertiedUser 'admin'>,
'view': <AutocompleteSelectionWidget 'form.widgets.integrated_in'>,
'views': <Products.Five.browser.pagetemplatefile.ViewMapper object at 0xb147fe0c>}
Module zope.tales.expressions, line 217, in __call__
Module Products.PageTemplates.Expressions, line 155, in _eval
Module Products.PageTemplates.Expressions, line 117, in render
Module z3c.formwidget.query.widget, line 212, in renderQueryWidget
Module z3c.form.widget, line 153, in render
Module zope.browserpage.viewpagetemplatefile, line 51, in __call__
Module zope.pagetemplate.pagetemplate, line 132, in pt_render
Module zope.pagetemplate.pagetemplate, line 240, in __call__
Module zope.tal.talinterpreter, line 271, in __call__
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 531, in do_optTag_tal
Module zope.tal.talinterpreter, line 513, in no_tag
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 821, in do_loop_tal
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 531, in do_optTag_tal
Module zope.tal.talinterpreter, line 513, in no_tag
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 742, in do_insertStructure_tal
Module zope.tales.tales, line 696, in evaluate
- URL: /home/maik/develop/plone/.buildout/eggs/z3c.form-3.2.3-py2.7.egg/z3c/form/browser/radio_input.pt
- Line 8, Column 4
- Expression: <PythonExpr (view.renderForValue(item['value']))>
- Names:
{'args': (),
'context': <Library at /ub/ub-db/1>,
'default': <object object at 0xb75116d0>,
'loop': {},
'nothing': None,
'options': {},
'repeat': {},
'request': <HTTPRequest, URL=http://localhost:8080/ub/ub-db/1/@@edit>,
'template': <zope.browserpage.viewpagetemplatefile.ViewPageTemplateFile object at 0xb482ab6c>,
'view': <AutocompleteSelectionWidget 'form.widgets.integrated_in'>,
'views': <zope.browserpage.viewpagetemplatefile.ViewMapper object at 0xb13e57ec>}
Module zope.tales.pythonexpr, line 59, in __call__
- __traceback_info__: (view.renderForValue(item['value']))
Module <string>, line 1, in <module>
Module z3c.form.browser.radio, line 44, in renderForValue
Module z3c.form.term, line 38, in getTermByToken
Module zope.schema.vocabulary, line 133, in getTermByToken
LookupError: --NOVALUE--
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.
Original author: [email protected] (July 06, 2010 14:52:07)
I am using the autocomplete widget with UserSource, the user I am searching for starts with an uppercase letter and is never found with the autocomplete widget.
Original issue: http://code.google.com/p/dexterity/issues/detail?id=135
See
Either the implementation is broken or the documenation on docs.plone.org is wrong.
Initiated by this quest on SO:
http://stackoverflow.com/questions/15651455/plone-dexterity-relationchoice-widget-clashes-with-jqueryui
Would it make sense, to exclude the autocomplete-javascripts of this product and instead use the one's of plone.app.jquerytools in order to avoid redundancy and conflicts?
If I want to change maxResults
for example:
I need to subclass/override the class or even create a patch. Being a registry entry, I can edit it using controlpanel.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.