form with several subforms?

Has someone tryed to create a form with several subforms?
I want to create an “personaldata” form with several addresses in single subforms,
but there is no example.

I think I have, but by subforms, do you mean one form in sections and using one sets of command buttons e.g “Save”, “Delete”, “Close” – as I did – or each subform with its own sets of command buttons. Please clarify.

Hello Benjamin,

i only want to store the complete form into one object. The object should send to another process.

I’m not exactly sure what you want, but I’ve just been studying a typical case where you have a bean with 1:n sub-beans. You can have a Form for the main bean and a Table to display and edit the sub-beans.

It is a bit cumbersome to do, requiring a couple of field factories with a

the on-line example

Hello Marko,

i want to have a form for a person with firstname, surname, salut,… and more than one address (Street, Housenumber, Postalcode and Location). I have tried it with customfield, but adding a list of customfields without
a table seems to be tricky :wink:

Variable number of addresses?

You could try using a CustomField (top-level layout and conversions, add/remove buttons etc.) that contains other CustomFields or simple Forms (address forms).

Yes, it is quite a few lines of code that way, but almost all of it can probably be made generic and reusable.

another variation
, using sub-forms inside the table. Using a Table isn’t really necessary there, you could also use a regular layout.

The example doesn’t (yet at least) have an add button for new items.

Hi Marko,

thx for this great example. “This is it”
Unfortunately I saw this side “Vaadin-Book Examples” never before.


I added the “Add” button to the example, but there’s some problem that it doesn’t work very well. It is possible to use a VerticalLayout instead of Table for the sub-forms, in which case there shouldn’t be any problem.