Form and multiple fields on the same line

I am using Form component and FormFieldFactory.
the FormFieldFactory puts all of the fields on their own line.
My question is can I use the Form and FormFieldFactory and put more then one field like State and Zip Code on the same line? Is there an example?
I have posted this question previously and the answer was to create another form for State and Zip when creating fields for the original form.

Does anyone has an example of how to do this, I can not get it work? When I create another form the fields are indented since the new form is inside the main form. So I don’t think I am doing this correctly.

I need:

Zip Code: ________________
City: _____________ St: __

When user enters zip code the program fill populate the City and the State.

Thank You

Peter

Hi, Peter!

In this case, perhaps a CustomLayout as the layout in your Form would be the easiest solution? When you set a CustomLayout as the layout of a form, the fields are placed in custom layout locations named after the property id.

Form.java:

    public void addField(Object propertyId, Field field) {
        ...
            if (layout instanceof CustomLayout) {
                ((CustomLayout) layout).addComponent(field, propertyId
                        .toString());
            }
        ...
    }

The book contains
more info on CustomLayouts
.

HTH,
/Jonatan


Ticket #2205
will probably help you, once it is fixed.

Thanks for your help!

But I guess I will have to use the CustomLayout.

I have tried the new FormWithComplexLayout Layout and it does not solve my problem. The problem with the FormWithComplexLayout is the GridLayout. If field1 is on the first row and it’s very long and you want to put 2 fields on the second row, the second field on the second row is aligned with the end of the first field on the first row.

example of FormWithComplexLayout:

Address1:


Zip Code: State:


and what I am looking for is:

Address1:__________________________________________________

Zip Code: _________ State:____