I have a text field for user input and as soon as it gets a content, I want to perform a service call.
I have added the OnChangeAjaxBehavior onUpdate() method for that, but it indicates the service call after every character.
My code:
getTextField().add(new OnChangeAjaxBehavior() {
private static final long serialVersionUID = 1L;
@Override
protected void onUpdate(AjaxRequestTarget target) {
refreshDependingComponents(target);
TemplatePage.refreshFeedback(target, getTextField());
getModelObject().setPeriod(getTextField().getInput());
if (code!= null) {
target.add(code);
}
}
How can I do that it only make the update and refresh when the user has already clicked away from the textfield?
Thank you!