Multiple column forms


How can I create a from with four colums?
The default for FormLayout is two.

Been struggling with this for days.

Best regards,

You could use a GridLayout as the form’s layout.

form.setLayout(new GridLayout(4,1));

OK, thanks.
How can I change the layout so that the caption will to the left rather than on top of the field?

That is a feature of the FormLayout. Can’t remember if it can be achieved with css for other layouts or if it requires more work. I recall this being asked previously, but can’t remember what the answer was. Try searching the forums and see if you’ll be able to find the post.

Not possible with the default layouts, other than FormLayout.

You could do use two separate FormLayouts (not Form, Form
) inside one HorizontalLayout.

Is this still the case?
I have a lot of fields in my form and it is extending past the bottom of the screen (and the bottom of the layout the form layout is in) thus I set the form to use a grid layout…but as mentioned above now the field captions are all above the fields themselves.

This cant be fixed some way?

Unfortunately, this is still the case. This thread is only a couple of weeks old and nothing has changed during that time. I’m also not aware of any official plans of making such layouts.

One option would of course be to create the layout yourself. That however would require you to get acquaintance with creating custom widgets with Vaadin, not the simplest task to do, but by no means impossible :slight_smile:

Thanks for the quick response.

Unfortunately the application I am developing is meant to sell using Vaadin to our company and this is mostly a proof of concept with a quick development schedule. But if we do choose to go with Vaadin I can definitely see use using GWT to create custom widget so thanks for the idea.

I guess I will have to try using two layouts for the form to get it working right now.

How about now?

See FieldGroup (e.g.
this page in the book
or search for examples). It provides the functionality of a Form without the layout part, which is up to you - you can then simply ask the FieldGroup to bind the data source to your fields etc.