How to validate fields in vaadin made form

前端 未结 3 1975
隐瞒了意图╮
隐瞒了意图╮ 2021-01-21 12:01

I am making a Java project with vaadin. Right now I have a user registration form looking like that:

public class RegistrationComponent extends CustomComponent i         


        
3条回答
  •  我在风中等你
    2021-01-21 12:40

    Problem solved, Apparently I wasn't looking deep enough before. Here it comes:

    field.addValidator(new StringLengthValidator("The name must be 1-10 letters (was {0})",1, 10, true));
    

    all details here: https://vaadin.com/book/-/page/components.fields.html

提交回复
热议问题