Hi,

I use the AutoCompleteTextField to allow the users to enter tags and I have
two issues:

1)
After the user has pressed the key "enter" I want to display the entered tag
in a label
and reset the AutoCompleteTextField to allow further inputs.
So the AutoCompleteTextField should be cleared which I try by 
setting a new empty String Model to AutoCompleteTextField :

        final WebMarkupContainer wrapper = new WebMarkupContainer("tagWrapper");
        wrapper.setOutputMarkupId(true);
        form.add(wrapper);
        
        wrapper.add(field);
        
        selectedTags = new Label("selectedTags", new Model<String>(""));
        wrapper.add(selectedTags);
        field.add(new AjaxFormSubmitBehavior(form, "onchange")
        {
            @Override
            protected void onSubmit(AjaxRequestTarget target)
            {
                IModel<String> tagModel = field.getModel();
                String currentTags =
selectedTags.getDefaultModelObjectAsString();
                currentTags = currentTags + " " + tagModel.getObject();
                selectedTags.setDefaultModelObject(currentTags);
                field.setModel(new Model<String>(""));
                //field.clearInput();
                
                target.addComponent(wrapper);
            }

        });

The selectedTags label gets rerendered and displays the tags but the
AutoCompleteTextField still
shows the last users input. 
How can I clear it?


2)
Ideally I want to have the AutoCompleteTextField on a form with 
other input components but pressing the key "enter" causes the form to
submit
and all validartors are triggered. Can I disable the form submit for the
AutoCompleteTextField component? I know I have to change the
AjaxFormSubmitBehavior to AjaxEventBehavior and use the "onchange" event.
But even then the form gets submitted.


Does anybody has a hint what I can do?

Thanks,
Oliver


-- 
View this message in context: 
http://www.nabble.com/AutoCompleteTextField-does-not-get-refreshed-tp22745172p22745172.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to