Closed jensens closed 1 year ago
I use two RelatedItemsFieldWidget
with upload enabled since quite some time without any issues https://github.com/collective/collective.behavior.relatedmedia/blob/main/collective/behavior/relatedmedia/behavior.py#L87 ... I quickly copied bits of your code above to my custom contenttype like this:
directives.widget(
"teaser_image",
RelatedItemsFieldWidget,
pattern_options={
"mode": "browse",
"recentlyUsed": True,
"scanSelection": True,
"selectableTypes": ["Image"],
"upload": True,
},
)
teaser_image = RelationChoice(
title=_("label_teaser_image", default="Teaser Image"),
vocabulary="plone.app.vocabularies.Catalog",
required=False,
)
directives.widget(
"slider_images",
RelatedItemsFieldWidget,
pattern_options={
"mode": "browse",
"recentlyUsed": True,
"scanSelection": True,
"selectableTypes": ["Image"],
"upload": True,
},
)
slider_images = RelationList(
title=_("label_teaser_image", default="Teaser Image"),
value_type=RelationChoice(
title=_("label_slidersimage", default="Slider Image"),
vocabulary="plone.app.vocabularies.Catalog",
),
required=False,
)
result: both fields have single upload dropdown and no JS error on the site ...
If you append ?loglevel=DEBUG
to your edit url and look at the browser console, there should be some more debugging info. This enables patternslib
and mockup
DEBUG logging ...
This fix just got released in plone.staticresources = 2.1.4
BUG/PROBLEM REPORT (OR OTHER COMMON ISSUE)
What I did:
I have a type with two relationfield and upload enabled on both of them.
On edit I got an error:
full image:![screenshot_2023-06-28_15:31:17_selection](https://github.com/plone/Products.CMFPlone/assets/157140/c39eb8c8-d4d8-49f4-a889-99b8357ae92c)
What I expect to happen:
No error and one working upload UI.
What actually happened:
The first upload menu shows two times the UI:
The second field looks fine:
What version of Plone/ Addons I am using:
Plone 6.0.6 and a custom type with schema like:
and with a subclassed field type:
cc @thet @petschki