Text fields read-only on Form even after setReadOnly(false)

Hello,

I have developed a UI where I am swapping two different forms depending on a combo box selection. The form that is initially displayed is shown correctly. However, when I swap in the other form, all the text fields on the form are read only.

I have tried enabling the individual fields, and have also tried enabling the entire form, but I can’t get the read-only bit turned off. In swapping the forms, I tried both using replaceComponent() on the parent, and also just modifying the bean directly to trigger display of the 2nd form.

Does anyone have any idea why the 2nd form, which looks extremely similar in code to the first one, is resisting the calls to make the fields writeable? I have lost 3 days trying to make this work.

Thanks in advance,
David

So it was a dumb user error… if you don’t have setter methods on the item data source bean, Vaadin will set your fields to be read-only on the form, even if you have set them otherwise in the Field objects. The lesson is… make sure you have generated setter methods for your data objects!

I had the same problem. This forum post helped - I added setter methods and now it’s working fine.

Sorry, but I think Vaadin has got this upside down.

If you make a form immediate, the fields don’t become immediate, as they have their own immediate flags on them. This is upside down because that leaves “form.immediate” with no useful semantics, and it makes it hard on the most common use case, that of controlling the imediacy of a form in a coarse grained manner.

If, on the contrary, I make a form non-readonly, then all the read-only fields that I configured suddenly become writeable. This is also upside down, because in this case I really want to control the read only status of the entire form in one shot, but without sacrificing the read only status of fields that were meant to be read only and were marked as such. This is the most common use case.