Ruby Forum Rails Spinoffs (closed, excessive spam) > Autocompleter not showing results div

Posted by Steve Finkelstein (Guest)
on 14.05.2008 18:59
(Received via mailing list)
Hey all,

I'm using a very straight forward implementation of Autocompleter.  My
constructor looks like the following:

  document.observe('dom:loaded', function() {
    new Ajax.Autocompleter('search_query', 'search_results', 'at.php', {
      method: 'get',
      paramName: 'typing'
    });
  })

Works great, makes a GET request to the server, and I can see my
responses coming back in Firebug.  I can also inspect the DOM and see
the result sets there which is a bunch of styled <div> elements.

However, with that said, my 'search_results' div gets display:none;
appended to it inline via the Autocompleter class.  Once the results
are in, it never shows the display.

Is there a reason for this?  Why is it not setting it to display:block
once the results have finished their round trip?

Thanks,

/sf
Posted by Greg Hemphill (Guest)
on 14.05.2008 19:08
(Received via mailing list)
I've noticed the same thing and was about to ask about it, so I don't
think it's an isolated problem.
Posted by Steve Finkelstein (Guest)
on 14.05.2008 19:37
(Received via mailing list)
I posted too soon, and I'll answer my own question here.

The formatting that the Autocompleter class is looking for is very
specific here.  I was returning a result set wrapped in <div></div>
elements, which scriptaculous is not found of.

It is currently only working if you wrap your result set in an
unordered list to display it.

HTH,

/sf