CustomField with validation

Hello,

I’m trying to create a CustomField. This CustomField contains a TextField and a Button… The button can only be clicked if there is a value in the textfield so I add a NullValidator on the TextField.
It works when the screen loads but when I add a value in the field; it stay marked as Invalid.
The Textfield is builded like

    textField = new TextField();
    textField.setNullRepresentation("");
    textField.setImmediate(true);
    textField.addValidator(new NullValidator("This field is required", false));

How can I make the validation work on the field?

Thank you

Note that the NullValidator can not fail for user input if you have not set setNullSettingAllowed(true) for the TextField.

However, that should not cause the invalid status to stay as such, and I’m not immediately sure why that would occur in your code.