[Catalyst] jquery autocomplete and JSON

Armin Wenz wenz at ub.uni-frankfurt.de
Fri Apr 29 10:55:24 GMT 2011

Hi all,

I've read the last years the thread about "Using Jquery UI Autocomplete 
widget with Catalyst::View::JSON". And still got a problem:

My template is:
<script type="text/javascript" 
<script type="text/javascript" 
<script type="text/javascript" 
<script type="text/javascript" 
<script type="text/javascript" 
<link rel="stylesheet" href="[% 
c.uri_for('/static/css/jquery/jquery.autocomplete.css') %]" ></link>

<script type="text/javascript">
   $("#model").autocomplete("[% c.uri_for('/model/modellist') %]", {
         selectFirst: false,
         width: 260,

<form id="commentForm" class="cmxform" method="post" action="[% 
c.uri_for('save') %]">
<td class="label">Modell</td>
<td class="data"><input id="model" name="model" size="40"  /></td>

In my Controller
sub modellist :Local {
     my ( $self, $c ) = @_;
     my @aoh = ( { value => "1", label => "betty", },
                 { value => "2", label => "jane", },
                 { value => "3", label => "marge", },
     $c->stash->{json} = \@aoh;

When I enter a character into the input-field, the above URL is called 
and the follwing data is returned:


But I don't get the expected dropdown, where I can select any of the 
returned data.

As far as the returned data seems to be okay, I assume that the mistake 
lies within the template (maybe I forgot something?)

Can anybody give me a hint?

Thanks in advance.


Armin Wenz

Universitätsbibliothek Johann Christian Senkenberg
Telefon: 069-798-39504

More information about the Catalyst mailing list