Hello,

I'm interested in the following behavior for an auto complete text field,
which is to contain a phone number:

-> when the user starts typing a phone number in the text field, the
autocomplete will present information structured like this [number] -
[name].
-> when the user selects a [number] - [name] record, the text field should
be filled only with [number].

What I managed so far is something like this:

            phone.add(new AjaxFormComponentUpdatingBehavior("onchange"){
                @Override public void onUpdate(AjaxRequestTarget target){

phone.setModelObject(telefon.getModelObjectAsString().substring(0, 10));
                    target.addComponent(phone);
                }
            });


but i'm sure there must be another, nicer way.

Tks, Cristi Manole

Reply via email to