Vaadin 24.0 TextField错误消息不显示问题咨询
TextField错误消息显示异常
以下是我的代码片段:
public MainView() { var tf = new TextField(); tf.setWidth("30em"); tf.setClearButtonVisible(true); tf.setRequired(true); tf.addValueChangeListener(event -> { if (event.getValue() == null || !event.getValue().contains("a")) { tf.setInvalid(true); tf.setErrorMessage("Error: input should be a text containing letter 'a'"); } else { tf.setInvalid(false); tf.setErrorMessage(null); } }); }
设置的错误消息无法显示,但点击清除按钮时消息会正常展示;再次输入无效内容后,错误消息又不再显示。
输入无效文本后的状态:
点击清除按钮后的状态:
内容的提问来源于stack exchange,提问作者rmuller
相关产品推荐
相关产品推荐

