Hi,
I saw the example of the autocomplete textfield at
http://www.wicket-library.com/wicket-examples/ajax/autocomplete.1 and
I'm trying to use it. Problem is it doesn't look like it responds at all
when I start typing in the textfield. I see that the rendered input
field does not have a onchange attribute added like the example does.
Does anyone know what I'm missing? Here is my html and java below?
<form wicket:id="form1">
Country: <input type="text" wicket:id="ac"
size="50"/>
</form>
and my java (same as the example)
Form<Void> form = new Form<Void>("form1");
add(form);
form.add(new AutoCompleteTextField<String>("ac", new
Model<String>(""))
{
protected Iterator<String> getChoices(String input)
{
if (Strings.isEmpty(input))
{
return Collections.EMPTY_LIST.iterator();
}
List<String> choices = new ArrayList<String>(10);
Locale[] locales = Locale.getAvailableLocales();
for (int i = 0; i < locales.length; i++)
{
final Locale locale = locales[i];
final String country = locale.getDisplayCountry();
if
(country.toUpperCase().startsWith(input.toUpperCase()))
{
choices.add(country);
if (choices.size() == 10)
{
break;
}
}
}
return choices.iterator();
}
});
}
Thanks a bunch, Jason
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]