Textfield extension does not work

Hi,

I just made the tutrial for extending a TextField (https://vaadin.com/de/blog/-/blogs/2656782). My Problem is, that it does not work. I want to have an additional desciption under the textfield, but in the HTML code, there ist no div, with my addiotional text.

Can anyone help me, to get this working? I attached my maven project…

chears

Sorry, i forgot to attach the project…
13335.tgz (7.79 KB)

Hi,

your client side code (extend method) is missing the call “textField.addAttachHandler(this);”, so your attach/detach event will never fire.

Additionally, you should not call TextField.attach() on the server side (your UI class). This is handled by the framework.

Thanks, that was it! It was a long night, and I did not see it xD

Is it possible to acces the caption of the Textfield, so that I can add an adtional stylesheet class to the caption?

greets

Ok, after serveral hours of searching and studying the code of vaadin, I found the solution for accessing the caption in a FormLayout. You can get the VFormLayout from the ServerConnector at “onFocus”-Method you can get the Caption of the VFormLayout’s Table, so you can add (or remove in “onBlur”) a StyleSheet class.