mbgold78
13 Aug 2010, 5:10 AM
Hello
Im trying to disable a button when a TextField is blank, see the below snippet, except the button does not grey until the textfield loses focus, even though the button is not clickable. How can I achieve the visual disable/enable without loses the field focus?
field.addListener(Events.Change, new Listener<FieldEvent>() {
@Override
public void handleEvent(FieldEvent be) {
String value = (String) be.getValue();
if (value != null && !value.isEmpty()) {
button.enable();
} else {
button.disable();
}
}
});
Im trying to disable a button when a TextField is blank, see the below snippet, except the button does not grey until the textfield loses focus, even though the button is not clickable. How can I achieve the visual disable/enable without loses the field focus?
field.addListener(Events.Change, new Listener<FieldEvent>() {
@Override
public void handleEvent(FieldEvent be) {
String value = (String) be.getValue();
if (value != null && !value.isEmpty()) {
button.enable();
} else {
button.disable();
}
}
});