TextField setErrorMessage is not showing error message on UI

Hello Im using Vaadin 23 im trying to set error message manually on some conditions but its not showing on the Ui

I debug the developers options to see whether it is getting hidden or something but that message is not present in the text field component.

I tried various ways like setRequiredIndicatorVisible(true) but the setErrorMessage and setInvalid is not working on the textField can anyone know the solution for it or any hack for doing the same in another way please help

Thanks

The simplest solution would be to use the Binder and create proper validations in there instead of setting the value of the error directly

Maybe you can try to explain what you are doing or what you want to do. Normally if you set an error message, you should see an error message but you might have something that removes it

The error message is shown only in the invalid state.

God bless you man !

I was setting an error message first and then invalids

Thank you so much :innocent: