0

I've just installed the Search Autocomplete module on my Drupal 7 site and try to get it to work. For this I also installed the jQuery update module and put it on jQuery 1.10. I didn't change any of the default settings of the search autocomplete module. When I start typing in my search field I get this jquery error:

Uncaught TypeError: Cannot read property 'label' of null jquery.ui.autocomplete.min.js?v=1.10.2:4 Uncaught TypeError: Cannot read property 'label' of null

So I tried finding out what is wrong by setting a breakpoint in the autocomplete jquery file. What I found out is that that on line 474 of this file there is this check:

if ( items.length && items[0].label && items[0].value ) {   return items; }

But it says that items is [null]. So I went back to views. The automatic generated view made by the autocomplete module outputs this:

[
  {
    "link" : "http://site.local:8888/content/elke",
    "value" : "Elke",
    "fields" : {
      "view_node" : "<a href=\"/content/elke\">view</a>",
      "title" : "Elke"
    },
    "group" : {
      "group_id" : "",
      "group_name" : ""
    }
  },
  {
    "link" : "http://site.local:8888/content/peuterdans",
    "value" : "Peuterdans",
    "fields" : {
      "view_node" : "<a href=\"/content/peuterdans\">view</a>",
      "title" : "Peuterdans"
    }
  },
  {
    "link" : "http://site.local:8888/content/sofie",
    "value" : "Sofie",
    "fields" : {
      "view_node" : "<a href=\"/content/sofie-noij\">view</a>",
      "title" : "Sofie"
    }
  }
]

So it's not null but is it the right output (following this http://api.jqueryui.com/autocomplete/ it is) for the jquery autocomplete? What am I doing wrong here?

4
  • Welcome to Drupal Answers! We cannot debug a site to which we don't have access, and the purpose of Stack Exchange sites is not guessing.
    – avpaderno
    Commented Oct 12, 2015 at 9:28
  • Thanks, i tried making it more specific. Anything else I can do?
    – Joost
    Commented Oct 12, 2015 at 13:29
  • You need to figure out where the null value is coming from. Try setting a breakpoint in the js using your browsers developer tools.
    – Steven
    Commented Oct 12, 2015 at 18:13
  • Whow thanks steven I didn't know that fuction yet. I edited my post again. Didn't find the solution yet but it brought me a little further. Something else I can do to get this a step further?
    – Joost
    Commented Oct 14, 2015 at 10:43

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.