Why is my CheckBox disabled ?

Hi all,

I have created a form via a FormFieldFactory. My problem is simple, all the controls I create in the createField() method behave normally except the CheckBox - which always appears disabled (ie: I can’t click on it and change it’s value)

Here’s a snippet to define the Form:

private class MyForm extends Form {

    public MyForm() {
       myXXXData = new XXXData();
       BeanItem<XXXData> myBeanItem = new BeanItem<XXXData>(myXXXData );


        feedBeanItem.addItemProperty("Item1", new NestedMethodProperty(myXXXData , "someProperty1"));
        feedBeanItem.addItemProperty("Item2", new NestedMethodProperty(myXXXData , "someProperty1"));
        feedBeanItem.addItemProperty("Item3", new NestedMethodProperty(myXXXData , "someProperty1"));
        setVisibleItemProperties(new Object[]{"Item1", "Item2", "Item3", "defaultBox"});

        // FieldFactory for customizing the fields and adding validators
        setFormFieldFactory(new MyFactory());

And here is the createField() from MyFactory

public Field createField(Item item, Object propertyId, Component uiContext) {

    switch ((String)propertyId) {
        case "Item1":
        case "Item2":
        case "Item3":
        case "defaultBox":
            CheckBox newCheckBox = new CheckBox();
            newCheckBox.setCaption("CheckBox Caption");
            return newCheckBox;

    return null;

And finally a screen capture of what the result looks like:

Any idea why the checkbox would be disabled?

Thanks a lot, this is puzzling to me.

Fields in a Form are automatically disabled if the property from the Item is marked as read only, which with a BeanItem probably probably means that a getter-method is found in the bean, but no matching setter method.

Thanks a lot, that was it: I did have a setter for the property but it had a typo in it, a lowercase in the wrong spot…

Another little point: the field factory should create the field, but its value will be (re)set by Form.setItemDataSource(). The setValue() line here probably does nothing.