plone / plone.app.mosaic

Plone Mosaic main repository
https://pypi.python.org/pypi/plone.app.mosaic
GNU General Public License v2.0
34 stars 26 forks source link

Overlay form (properties) duplicates element ids #578

Closed jensens closed 11 months ago

jensens commented 11 months ago

The IDs are duplicated which results into problems. IDs have to be unique by HTML specification.

Known problem: The ordered select input widget is broken currently. It uses document.getElementById with the IDs of the current widget. Instead of finding the active form element it get the hidden one. This result in an error message (alert) on click: "Must select something!".

gogobd commented 11 months ago

Maybe it is possible to prefix the original ids with something during the duplication and un-prefix them when the temporary copy is being closed. Probably that "duplication action" happening in patterns and the problem's there. "setup_vivibility" might be a good spot to make it work. The events "hide", "hidden" looked promising, too.

jensens commented 11 months ago

@petschki What do you think?

petschki commented 11 months ago

Instead of fiddling around with the duplicated @@edit form in the modal (which is loaded via AJAX) I have tried to use the original hidden form inside .mosaic-original-content as modal content for manipulation. But pat-plone-modal always clones the modal content so you have duplicated IDs anyways. I also thought about getting rid of pat-plone-modal and use native html dialog elements, but that leads to even more problems with patterns loaded inside the dialog. long story short: cleanest solution IMHO would be to use the hidden form as modal content, manipulate it and hide it again.

petschki commented 11 months ago

Duplicated Element IDs is solved in #577 ... orderedselectwidget could need some love though https://github.com/plone/plone.app.z3cform/issues/184