The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Rose::HTMLx::Form::Field::Autocomplete - Ajax autocompletion for text fields

SYNOPSIS

 my $field = Rose::HTMLx::Form::Field::Autocomplete->new(
    label           => 'Complete Me',
    name            => 'completer',
    size            => 30,
    maxlength       => 128,
    autocomplete    => 'http://myserver.foo/completer/url,
    limit           => 30
 );
 
 print $field->xhtml;
 
 ...

DESCRIPTION

This subclass of Rose::HTML::Form::Field::Text is intended to make it easier to integrate Ajax autocompletion into your web applications. You define a URL where your web application can find suggested values for the field, and optionally, a limit on the number of suggestions returned by the server.

This subclass is expected to be used with Catalyst::Controller::Rose::Autocomplete but that is not required.

METHODS

Only changes from Rose::HTML::Form::Field::Text are documented here.

autocomplete

Expects a URL value but any string is acceptable. See url().

limit

Expects an integer, which will be used in the construction of url().

url

Returns the URL for use in your template. The return value is an array ref, with the first value being the base URI and the second value being a hashref of param key/value pairs. The hashref keys are in the syntax that Catalyst::Controller::Rose::Autocomplete expects.

See the Catalyst::Controller::Rose example application for examples of using the url() method with Template Toolkit.

url_as_string

Like url() but the return value is a scalar string, not an array ref. The value is the URI-escaped value of url().

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.

SEE ALSO

Catalyst::Controller::Rose::Autocomplete, Rose::HTML::Objects, Rose::HTML::Form::Field