[Catalyst] jquery autocomplete and JSON

Oroszi, Róbert robert at oroszi.net
Fri Apr 29 11:03:34 GMT 2011


I think it's a client side problem, that Autocomplete plugin is not the
jQuery UI Autocomplete.
You should grab the latest from http://jqueryui.com and you can read the
documentation here: http://jqueryui.com/demos/autocomplete/

ps: the JSON data structure is fine.

2011/4/29 Armin Wenz <wenz at ub.uni-frankfurt.de>

> 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=3D"text/javascript"
> src=3D"/static/js/jquery.validate.min.js"></script>
> <script type=3D"text/javascript"
> src=3D"/static/js/jquery.bgiframe.min.js"></script>
> <script type=3D"text/javascript"
> src=3D"/static/js/jquery.ajaxQueue.js"></script>
> <script type=3D"text/javascript"
> src=3D"/static/js/jquery.autocomplete.min.js"></script>
> <script type=3D"text/javascript"
> src=3D"/static/js/thickbox-compressed.js"></script>
> <link rel=3D"stylesheet" href=3D"[%
> c.uri_for('/static/css/jquery/jquery.autocomplete.css') %]" ></link>
>
> <script type=3D"text/javascript">
> <!--
>  $(document).ready(function(){
>  $("#model").autocomplete("[% c.uri_for('/model/modellist') %]", {
>        selectFirst: false,
>        width: 260,
>  });
>  });
> //-->
> </script>
>
> <form id=3D"commentForm" class=3D"cmxform" method=3D"post" action=3D"[%
> c.uri_for('save') %]">
> <table>
> <tr>
> <td class=3D"label">Modell</td>
> <td class=3D"data"><input id=3D"model" name=3D"model" size=3D"40"  /></td>
> </tr>
> </table>
> </form>
>
>
> In my Controller
> sub modellist :Local {
>    my ( $self, $c ) =3D @_;
>    my @aoh =3D ( { value =3D> "1", label =3D> "betty", },
>                { value =3D> "2", label =3D> "jane", },
>                { value =3D> "3", label =3D> "marge", },
>              );
>    $c->stash->{json} =3D \@aoh;
>    $c->forward('View::JSON');
> }
>
> When I enter a character into the input-field, the above URL is called and
> the follwing data is returned:
>
>
> [{"value":"1","label":"betty"},{"value":"2","label":"jane"},{"value":"3",=
"label":"marge"}]
>
> 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=E4tsbibliothek Johann Christian Senkenberg
> Telefon: 069-798-39504
>
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive:
> http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20110429/6788d=
0e2/attachment.htm


More information about the Catalyst mailing list