question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bindfields.js:14 Uncaught ReferenceError: chainedfk is not defined - Django Admin

See original GitHub issue

Checklist

Put an x in the bracket when you have completed each task, like this: [x]

  • This issue is not about installing previous versions of django-smart-selects older than 1.2.8. I understand that previous versions are insecure and will not receive any support whatsoever.
  • I have verified that that issue exists against the master branch of django-smart-selects.
  • I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
  • I have debugged the issue to the smart_selects app.
  • I have reduced the issue to the simplest possible case.
  • I have included all relevant sections of models.py, forms.py, and views.py with problems.
  • I have used GitHub Flavored Markdown to style all of my posted code.

Error received within Google Chrome when loading Django admin page of a model with an inline model which uses smart-selects.

bindfields.js:14 Uncaught ReferenceError: chainedfk is not defined
    at initItem (bindfields.js:14)
    at HTMLSelectElement.<anonymous> (bindfields.js:35)
    at Function.each (jquery-2.2.0.js:360)
    at HTMLDocument.<anonymous> (bindfields.js:34)
    at fire (jquery-2.2.0.js:3182)
    at Object.fireWith [as resolveWith] (jquery-2.2.0.js:3312)
    at Function.ready (jquery-2.2.0.js:3531)
    at HTMLDocument.completed (jquery-2.2.0.js:3547)

Steps to reproduce

Environment:

  • Django 1.10.7
  • Latest build django-smart-selects
  • Jquery (2.2.0 / 2.2.3 / 2.2.4 / 3.3.1) (multiple versions tested)
  1. Configured Django Instance as specified in the installation and configuration guides.
  2. Smart Selects used on a Model, which is present as an InlineForm on another model Admin page
  3. Load page

Actual behavior

Nothing. Error in Javascript prevents the code being actioned.

Expected behavior

Smart-selects should load two fields normally, and provide smart select functionality between them.

I actually removed all other Javascript references and inline javascript code from the HTML in order to check that there wasn’t a conflicting code issue, but found nothing.

The script files are loaded in the correct order, none are 404-ing:

<script type="text/javascript" src="/admin/jsi18n/"></script>
 <script type="text/javascript" src="/static/admin/js/core.js"></script>
 <script type="text/javascript" src="/static/admin/js/vendor/jquery/jquery.js"></script>
 <script type="text/javascript" src="/static/admin/js/jquery.init.js"></script>
 <script type="text/javascript" src="/static/admin/js/admin/RelatedObjectLookups.js"></script>
 <script type="text/javascript" src="/static/admin/js/actions.js"></script>
 <script type="text/javascript" src="/static/admin/js/urlify.js"></script>
 <script type="text/javascript" src="/static/admin/js/prepopulate.js"></script>
 <script type="text/javascript" src="/static/admin/js/vendor/xregexp/xregexp.js"></script>

 <script type="text/javascript" src="/static/smart-selects/admin/js/chainedfk.js"></script>
 <script type="text/javascript" src="/static/smart-selects/admin/js/bindfields.js"></script>

 <script type="text/javascript" src="/static/admin/js/calendar.js"></script>
 <script type="text/javascript" src="/static/admin/js/admin/DateTimeShortcuts.js"></script>

Can’t for the life of me see what’s wrong. I think the error being thrown-up might be misleading somehow? I even combined the smart-select Javascript together, so that there would be no scope issues.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:40 (3 by maintainers)

github_iconTop GitHub Comments

24reactions
blagcommented, Mar 28, 2018

Hi everybody, I think I fixed this in the js-unlinting-fixes branch. If you are still having the issue, can you try that and tell me if it works?

You should be able to install that branch using pip:

pip install git+https://github.com/digi604/django-smart-selects.git@js-unlinting-fixes
Read more comments on GitHub >

github_iconTop Results From Across the Web

bindfields.js:14 Uncaught ReferenceError: chainedfk is not ...
bindfields.js:14 Uncaught ReferenceError: chainedfk is not defined - Django Admin.
Read more >
django smart select not working in admin - Stack Overflow
Uncaught ReferenceError : chainedfk is not defined at initItem (bindfields.js:12) at HTMLSelectElement.<anonymous> (bindfields.js:31) at ...
Read more >
The Django admin site
It reads metadata from your models to provide a quick, model-centric interface where trusted users can manage content on your site. The admin's...
Read more >
Django real-time notifications with SwampDragon | Wildfish
We set the model to Notification and specify the template to be ... notifications.js:14 Uncaught ReferenceError: swampdragon is not defined.
Read more >
Django Admin JS 404 and Uncaught TypeError - DigitalOcean
Django Admin JS 404 and Uncaught TypeError ... of 404 (Not Found) jquery.init.js:7 Uncaught ReferenceError: jQuery is not defined(anonymous ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found