Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个关于 Vaadin 的 TextField 的问题。我想在他达到 20 个字符的 maxLength 时阻止输入......我该怎么做?我已经尝试通过验证将其设置为立即,但这仅在您执行 isValid() 时才有效...
谁能帮我?谢谢你
您可以使用Textfield.setMaxLength(int maxLength)方法设置文本字段的最大字符数。
Textfield.setMaxLength(int maxLength)
例如,使用上面以 3 作为参数的方法,将阻止用户插入四个(以及更多)字符。
问候。
埃里克。