I'm not sure if this will help or not. I received this info a few
days back on adding autocomplete code to a test I'm working on:
From Dmitry:
Using autocomplete is 2-step process. See attachment below for
excerpts from TLD docs, but in short autoComplete and
autoCompleteExpression must be defined.
In order to use it, fields must be bound like this:
autoComplete="true"
autoCompleteExpression = "#{AutoCompleteBean.getOptions}"
where AutoCompleteBean is
<managed-bean>
<description>The backing bean for the field autoComplete
example</description>
<managed-bean-name>AutoCompleteBean</managed-bean-name>
<managed-bean-class>autocomplete.AutoCompleteBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
"Attribute indicating to turn on/off the autocomplete functionality of
the TextField. Autocomplete would trigger the AJAX request to the
component.
Autocomplete will submit the content of the text field for server side
processing that will be processed using JSFX partial lifecycle cycle.
Providing of autoComplete options remains responsibility of the
developer. Specifically, autoCompleteExpression needs to be set
By default autocomplete is off."
and for autoCompleteExpression :
" Use the autoCompleteExpression to specify the method that will
filter an autoCompleteExpression list, i.e. to produce new set of
options to be rendered as autoComplete prompts ( see
autoCompleteExpression) . When autoComplete mechanism is enabled ( by
specifying autoComplete attribute), autoCompleteExpression method will
be called using the Ajax mechanism in the background every time user
changes the content of the field. Note that this requires
autoCompleteExpression method to perform well. Also, it is recommended
to limit number of options available to user as the return of this
method - both for usability and in order to increase download speed.
The value of autoCompleteExpression must be an EL expression and it
must evaluate to the name of a public method that is defined by
com.sun.webui.jsf.model.AutoComplete, something like: public Options[]
getOptions(String filter) { ... } In this example, expression would
look like this: < webuijsf:textField autoComplete = "true"
autoCompleteExpression ="#{AutoCompleteBean.getOptions}"
text="#{AutoCompleteBean.text}" label = "AutoComplete" id = "tf" />
"
autozoom wrote:
hello,
I tried the autocomplete function in 4.2 build 5, like this:
<webuijsf:textField autoComplete="true" id="textField1" style="position:
absolute; left: 180px; top: 252px"
autoCompleteExpression ="#{Page1.getOptions}"/>
where
public Option[] getOptions(String filter) {
Option[] ret = new Option[3];
ret[0] = new Option(1L, "uno");
ret[1] = new Option(2L, "due");
ret[2] = new Option(3L, "tre");
return ret;
}
but nothing happens when typing in the textfield; it doesn't seem to
be a
problem of code, it just doesn't fire any ajax call when typing
what am I missing?