I am using textField and passwordField. I want to restrict user inputs, i.e. even user tries to type a certain character it should not be allowed to enter. Like special characters. There don’t seem to be any attributes present for that.
Also, I have checked Flow UI and in Flow UI these attributes are present. But since Flow UI is in incubating stage I don’t want to risk it in project.
This task can be accomplished on the server side, i.e. in the screen controller by changing textChangeEventMode to EAGER and subscribing to ValueChangeEvent, e.g.:
@Subscribe("usernameField")
public void onUsernameFieldValueChange(final HasValue.ValueChangeEvent<String> event) {
if (event.isUserOriginated()) {
if (!testValue(event)) {
event.getComponent().setValue(event.getPrevValue());
}
}
}
For now, PasswordField misses textChangeEventMode attribute in XML, but this can be changes using Java API in screen controller.