jazzband / django-smart-selects

chained and grouped selects for django forms
https://django-smart-selects.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
1.1k stars 348 forks source link

Uncaught ReferenceError: node is not defined when using horizontal=True #299

Closed leibowitz closed 3 years ago

leibowitz commented 4 years ago

Checklist

Steps to reproduce

  1. Use ManyToMany field with horizontal=True and add model to admin
  2. Revert https://github.com/jazzband/django-smart-selects/commit/00b533c9aa057ee008c363cea3c75633e169b4b3 or use the changes in https://github.com/jazzband/django-smart-selects/pull/298
  3. See an error in the console when accessing admin page with the field

Actual behavior

Error:

chainedm2m.js:123 Uncaught ReferenceError: node is not defined
    at Object.success (chainedm2m.js:123)
    at fire (jquery.js:3291)
    at Object.fireWith [as resolveWith] (jquery.js:3421)
    at done (jquery.js:9533)
    at XMLHttpRequest.<anonymous> (jquery.js:9785)

https://github.com/jazzband/django-smart-selects/blob/656e48579c7c37970bbd54ed7205aa029e6fd73a/smart_selects/static/smart-selects/admin/js/chainedm2m.js#L122-L123

Expected behavior

No errors

leibowitz commented 4 years ago

It seems to be because it's using strict mode and the variable node has not been defined