smcyr / Craft-FocusPoint

A plugin for Craft CMS based on jQuery FocusPoint
MIT License
101 stars 6 forks source link

Internal Server Error: Undefined Offset #11

Closed MattWilcox closed 7 years ago

MattWilcox commented 7 years ago

There is a bug with the behaviour of FocusPoint which triggers an Internal Server Error from the CMS.

If an Entry has a FocusPoint field which itself has multiple images in it, it is only possible to delete an image from the field if it is the last image in the field. Attempting to delete any other image and then saving the Entry results in an "Undefined offset: XX" error.

The workaround is to drag whichever image you want to delete to become the last image in the list, save the entry, and then edit the entry again and delete the last image in the field. The entry will then save without error.

MattWilcox commented 7 years ago

Any updates on getting this fixed? Our clients have been running into this a few times now.

eriweb commented 7 years ago

Getting the same, would appreciate a fix

smcyr commented 7 years ago

Thank you terbolous for your pull request, I made a fix based on that. Let me know if the error is fixed in 1.1.2. Thanks

alexhillel commented 7 years ago

I'm getting a JS error with the new version which is breaking the Craft control panel.

    Uncaught TypeError: Cannot read property 'on' of undefined
    at HTMLDivElement.<anonymous> (jquery.focuspoint.helpertool.js?d=1494920842:82)
    at Function.each (jquery-2.2.4.min.js?d=1494671366:2)
    at n.fn.init.each (jquery-2.2.4.min.js?d=1494671366:2)
    at n.constructor.init (jquery.focuspoint.helpertool.js?d=1494920842:79)
    at n.constructor.constructor (garnish.js:5785)
    at n.constructor (garnish.js:5785)
    at new n.constructor (garnish.js:5785)
    at 15-about:2390

Looks like a problem with the dragStop handler.

smcyr commented 7 years ago

I made a fix for this javascript error.

eriweb commented 7 years ago

Thanks, will take a look :-)