mockup icon indicating copy to clipboard operation
mockup copied to clipboard

Callback actions raise error in select2 pattern

Open laulaz opened this issue 6 months ago • 1 comments

On Plone 6.1, I'm trying to use the select2 pattern with callback action for onSelected (but this also applies to onSelecting, onDeselecting, onDeselected).

If I pass the callback as a string referencing an existing JS function via pattern options (options["onSelected"] = "myFunction"), the JS throws an error at this line after a selection has been made in the select2 field : https://github.com/plone/mockup/blob/253d77a91ac159c2c57c75eda129d9d2aabaf4df/src/pat/select2/select2.js#L133 Uncaught TypeError: this is undefined

The function is never called.

laulaz avatar Jun 18 '25 08:06 laulaz

Are you able to create a fixing PR ?

petschki avatar Jun 23 '25 14:06 petschki