text field shows up as label

I’m trying to create a form that is backed by a bean. When I create the form. The text fields just show up as labels.

I’ve tried setting various read only attributes…


Form form = new Form();
form.setItemDataSource(new BeanItem<MyDto>(input));	
final TextField field = new TextField("Field Name");
form.addField("fieldName", field);
form.setVisibleItemProperties(new String[]{"fieldName", "otherField"});
						
verticalLayout.addComponent(form);
setCompositionRoot(verticalLayout);
setSizeFull();

If the bean does not have a setter then the field will be a label