Re: using AutoCompleteTextField with wicket 1.4-rc1

2009-01-07 Thread Jason Novotny


I found my problem-- mootools javascript and wicket ajax components 
don't play nicely :-(


Jason Novotny wrote:


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)

FormVoid form = new FormVoid(form1);
   add(form);

   form.add(new AutoCompleteTextFieldString(ac, new 
ModelString())

   {
   protected IteratorString getChoices(String input)
   {
   if (Strings.isEmpty(input))
   {
   return Collections.EMPTY_LIST.iterator();
   }

   ListString choices = new ArrayListString(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: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



using AutoCompleteTextField with wicket 1.4-rc1

2009-01-06 Thread Jason Novotny


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)

FormVoid form = new FormVoid(form1);
   add(form);

   form.add(new AutoCompleteTextFieldString(ac, new 
ModelString())

   {
   protected IteratorString getChoices(String input)
   {
   if (Strings.isEmpty(input))
   {
   return Collections.EMPTY_LIST.iterator();
   }

   ListString choices = new ArrayListString(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: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org