org.apache.tapestry5.corelib.mixins.Autocomplete

A mixin for a text field that allows for autocompletion of text fields. This is based on Prototype's autocompleter control. The mixin renders an (initially invisible) progress indicator after the field (it will also be after the error icon most fields render). The progress indicator is made visible during the request to the server. The mixin then renders a div that will be filled in on the client side with dynamically obtained selections. Multiple selection on the client is enabled by binding the tokens parameter (however, the mixin doesn't help split multiple selections up on the server, that is still your code's responsibility). The container is responsible for providing an event handler for event "providecompletions". The context will be the partial input string sent from the client. The return value should be an array or list of completions, in presentation order. I.e. String[] onProvideCompletionsFromMyField(String input) { return . . .; }

[JavaDoc]

Component Parameters

NameTypeFlagsDefaultDefault PrefixDescription
frequencydoubleNOT Allow NullliteralOverrides the default check frequency for determining whether to send a server request. The default is .4 seconds.
minCharsintNOT Allow NullliteralOverwrites the default minimum characters to trigger a server round trip (the default is 1).
tokensStringNOT Allow NullliteralIf given, then the autocompleter will support multiple input values, seperated by any of the individual characters in the string.

Back to index