Strange Form Behavior with FormFieldFactory

I am new to Vaadin and facing many problems with Form Behavior when used with FormFieldFactory (when fields directly added to form i.e. non-databound then it works fine). Already searched lot of vaadin forums and tutorials but in vain.

Firstly, all TextFields shows “null” by default when form gets loaded, i tried setting everything to this field but null doesn’t go away, it goes away only if the property in my bean itself is changed to “”. This works well if TextField directly added on form, so seems its a bug with FormFieldFactory.

Secondly, none of the fields (textfields, combo, Date) shows input prompt when form gets loaded, it shows input prompt only when focus gets inside the field and gets out.

Thirdly, it doesn’t show date value when it is marked as readOnly().

Fourth, validation of Required (alongwith RequiredMessage) doesn’t work on any comboBox, it still allows form.commit() without any error. I tried adding my validator but it causes that validation to execute even when combo is loaded at first showing it at error from the very beginning.

Would really appreciate an early reply.

My code:


conditionForm.setWriteThrough(false);
conditionForm.setInvalidCommitted(false);

List props = Arrays.asList(new String[]{"a", "b", "c", "d", "e", "f" });
conditionForm.setFormFieldFactory(new ConditionFieldFactory());
conditionForm.setItemDataSource(conditionItem, props);

class ConditionFieldFactory extends DefaultFieldFactory {

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

        if ("a".equals(propertyId)) {
            TextField f = new TextField("A");
            f.setRequired(true);
            f.setWidth(COMMON_FIELD_WIDTH);
            f.setInputPrompt("4-7 digits");
            f.setMaxLength(7);
            f.setValidationVisible(true);
            f.setValue(""); 
            return f;
        } else if ("c".equals(propertyId)) {
            PopupDateField df = null;
            try {
                df = new PopupDateField("End Date",new SimpleDateFormat("dd.MM.yyyy").parse("31.12.2099"));
                df.setReadOnly(true);
                df.setDateFormat("dd.MM.yyyy");
                df.setValue(new SimpleDateFormat("dd.MM.yyyy").parse("31.12.2099"));
            } catch (ParseException e) {
                e.printStackTrace();
            }
             return df;
        } else if ("d".equals(propertyId)) {
            ComboBox firstTerm = new ComboBox("d", Arrays.asList(new String[]{"3","6","10"}));
            firstTerm.setInputPrompt("Select");
            firstTerm.setNullSelectionAllowed(false);
            firstTerm.setInvalidAllowed(false);
            firstTerm.setRequired(true);
            firstTerm.setRequiredError("Select one value for D.");
            firstTerm.setWidth(COMMON_FIELD_WIDTH);
            //firstTerm.addValidator(new NonZeroValidator("Select one value for D."));
            return firstTerm;
        }
}}