[Catalyst] Catalyst::Plugin::Prototype: current state ? / autocompletion

Dami Laurent (PJ) laurent.dami at justice.ge.ch
Sun Mar 21 18:30:34 GMT 2010


 
>-----Message d'origine-----
>De : Alex Povolotsky [mailto:tarkhil at over.ru] 
>Envoyé : samedi, 20. mars 2010 14:30

>Can anyont point me at
>
>- interoperability with C::P::P and current Prototype
>- maybe other Catalyst JS plugins?
>
>I'm mostly interested in COMPLEX autocompletion right now.
>
>BTW, maybe someone can clue me with my current task
>
>I have a large (10000+) database of people, and many-to-many 
>relationship people-request, so I should write some form to add people 
>to request.
>
>Loading all database into selectbox is not suitable for 
>obvious reason. 
>I'd like to write an Ajax-based autocompletion with "add to 
>list" button 
>enabled only when selection is fully done.

Hi Alex,

If you need sophisticated autocompletion, have a look at 
http://cpansearch.perl.org/src/DAMI/Alien-GvaScript-1.21/doc/html/Intro.html
http://cpansearch.perl.org/src/DAMI/Alien-GvaScript-1.21/doc/html/AutoCompleter.html


There is no Catalyst plugin but it's quite simple to integrate it into a Catalyst app :

a) write a Controller that will receive the Ajax requests and answer with a JSON datastructure (arrayref of possible values, or, if you want more complex behaviour on the client-side, arrayref of hashrefs with several fields for each returned entry).
b) serve the GvaScript.js file through Static::Simple or directly through your HTTP server
c) in your HTML page, include the GvaScript.js and write the JS code for initialising the Autocompleter object, giving it the URL for the Ajax controller and setting the appropriate options, as described in the doc. You can specify delays, case sensitivity, strictness, typeahead features, dependent fields, and many other options. 

If you need an example, install the Pod::POM::Web local documentation server and see how it works; it uses the autocompleter for perl functions and perl variables.

Good luck, Laurent Dami



More information about the Catalyst mailing list