NAME
Catalyst::Controller::Rose::Autocomplete - RDBO/RHTMLO Ajax Autocompletion
SYNOPSIS
# your controller code
package MyApp::Controller::AC;
use base 'Catalyst::Controller::Rose::Autocomplete';
sub model_name { 'SomeThing' }
1;
# and in your template
# search column 'foo' and return 10 results.
[% PROCESS tt/autocomplete.tt
input = {
id = 'foo',
url = c.url_for('/ac/list?c=foo&l=10'),
label = 'Enter your Foo here:'
}
%]
DESCRIPTION
Catalyst::Controller::Rose::Autocomplete is a simple controller for answering client-side Ajax autocomplete requests. It is designed to work with the Scriptaculous and Prototype JavaScript libraries, but the output format can be adapted for any Ajax autocomplete framework.
METHODS
The following methods are available:
list
This method handles the input param parsing and creates a query to hand to find(). list() then creates the correct HTML format and sets response body.
find( context, query )
The default find() method returns an array of scalar values suitable for returning to the browser. It is called by list().
find() is a prime candidate for overriding in your subclass.
EXAMPLES
See the examples/ dir in the distribution.
AUTHOR
Peter Karman <perl@peknet.com>
Thanks to Atomic Learning, Inc for sponsoring the development of this module.
LICENSE
This library is free software. You may redistribute it and/or modify it under the same terms as Perl itself.