Hello everyone.
I have problem with two AutoCompleteTextFields and ajax.

There is form which contains only two AutoCompleteTextFields. The list of
values on the second field is limited depending on the value of the first
field. So if you change value of first field, the second field should be
refresh. Below is source code of this form:


        final Model<String> m1 = new Model<String>();
        AutoCompleteTextField<String> t1 = new
AutoCompleteTextField<String>("t1", m1, settings) {
            
            List<String> values;
            
           @Override
            protected Iterator<String> getChoices(String input) {
                values = new LinkedList<String>();
                for (int i = 0; i < 20; i++) {        // I create the list
of example values
                    values.add(input + " " + i); 
                }
                return values.iterator();
            }
        };


        final Model<String> m2 = new Model<String>();
        final AutoCompleteTextField<String> t2 = new
AutoCompleteTextField<String>("t2", m2, settings) {

            List<String> values;

            @Override
            protected Iterator<String> getChoices(String input) {
                values = new LinkedList<String>();
                // I create the second list of example values which are
depedent on the value of the first field
                for (int i = 0; i < 20; i++) { 
                    values.add(input + " " + i + " - " + m1.getObject());
                }
                return values.iterator();
            }
        };

        t1.add(new AjaxFormComponentUpdatingBehavior("onchange") {

            @Override
            protected void onUpdate(AjaxRequestTarget art) {
                m2.setObject(null);
                art.addComponent(t2);
            }
        });


The problem occurs when I am executing the following scenario:
1. I write some text into the first field.
2. I write some text into the second field.
3. I clear first field's input and I click 'Tab' to set foucs on the second
textfield.
4. I write some text into the second field.
Now, there is impossible to select value from list of values using mouse.
Could you have any Idea how to resolve this problem with mouse? 
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Two-AutoCompleteTextFields-and-ajax-tp3067005p3067005.html
Sent from the Users forum mailing list archive at Nabble.com.

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

Reply via email to