Vaadin Binder.bindInstanceFields(this);

Hi im using Vaadin 8.0.1

I am trying to validate my which contains some form fields
as follows

void form(VerticalLayout pPartyLayout) {

    class MyForm extends CustomComponent {

        private static final long serialVersionUID = 1L;

        TextField name = new TextField();
        TextField mDesc = new TextField();
        DateField mDateField = new DateField();
        ComboBox<PersonData> mComboBox = new ComboBox<>();
        ComboBox<String> mStrComboBox = new ComboBox<>();

        public MyForm() {

And i m using Binder for validating it its not validating .
Binder binder = new Binder<>(PersonData.class);
binder.bindInstanceFields(this);
binder.setStatusLabel(emailStatus);

i dont want to write validation for each and every fields
How can i use
binder.bindInstanceFields(this);
in proper way
i am not getting any sample of using it.

Thanks
Nagaraj RC

What kind of validation do you want to do? The framework cannot guess them :stuck_out_tongue: so you must provide either, validations with reference methods, lambdas or classes (through the
Binder::withValidator
method); or use the annotations available in the Bean Validation API. You can find documentation with examples in the following links:


https://vaadin.com/docs/-/part/framework/datamodel/datamodel-forms.html#validating-and-converting-user-input


https://vaadin.com/docs/-/part/framework/datamodel/datamodel-forms.html#datamodel.forms.beans