Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Dynamicly add fields to a form
Hello
As a newby in Vaadin (I started development with vaadin two weeks ago), all the vaadin concepts are already quiet new for me. Most of the things worked fine so far. The first thing I found no appropriate documentation for is the more advanced form handling in vaadin.
I'm now about to create a user creation form which should contain the ability add multiple e-mail aliases. For this I should have the possibility to add a button which adds a new textfield to the form (at a specific location) in which the admin can add addtional e-mail aliases for the user. The simple form demo and the advanced layout form demo had no sample code which would give me an idea how to implement such a feature.
Can someone give me hint how to implement a such feature in vaadin?
Regards
Roland
Hello
Its ab it irritating to read no answer at all. Is the question that dump or is it impossbile to using the form layout for a such function?
Roland
Dit you try form.addField(), form.getLayout().addComponent()?
Hello
Yea, but I have to add the new field to a specific location within the form.
Sorry, the question was not fully clear in that point.
The method form.getLayout().addComponent() adds the component at the end of the form. But the (initial) e-mail alias field is somewhere in the middle of the form.
The new alias field should be below that field and not at the end of the whole form.
Roland
You can add at a certain index:
FormLayout layout = (FormLayout)form.getLayout();
layout.addComponent(emailField, index);