Important Notice - Forums is archived

To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Product icon

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.

Non-editable TextField or Label?

Jean-François Lamy
1 decade ago Feb 26, 2010 7:31pm
Lam Le
1 decade ago Apr 14, 2011 1:26pm
Marcin Koziarski
1 decade ago Aug 16, 2012 4:34am
David Wall
1 decade ago Aug 16, 2012 5:05pm
Rick Wong
10 years ago Feb 12, 2013 1:16am
Petr Hariprasad Hajič
7 years ago Apr 27, 2015 8:02am

If field is binded withs some bean, which has no properly setted setters, than field is automatically readonly. To check this behavior - comment the binding (bind method) and try if field is now writable.

Michael Hentze
6 years ago Jul 06, 2016 6:40am

Thanks Petr, this answer was helpful and it worked out well meaning my (now non-editable) UI TextField showed up the same fashion as an editable TextField but it was locked for editing its text in UI.

Strangely enough, this behavior couldn't be gained with either adding the "readonly" attribute in the TextField's definition in the underlying html design file as well as in programmatically setting "fooTextField.setReadOnly(true)". The TextField remained editable, it could be entered with edit cursor and its visual content could be altered (didn't test if changes would have been saved to linked bean field).

I wonder what may be the reason for that behavior... could it have sth to do with style sheets?

Testing on the multimodule example of Vaadin 7.6.2.

Walace Maia
6 years ago Jan 07, 2017 9:19am