Loading...
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.

Product icon
TUTORIAL

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.

Form handles pojo within a pojo

Stephen Lang
1 decade ago Feb 18, 2010 4:57am
Kim Leppänen
1 decade ago Feb 18, 2010 6:15am

Sure it can, but you'll have to done some work to get it the way you want. The form cannot know how you want to display the Address reference, do you want it to be a select component where you select one available addresses or do you want the address to render as a form itself?

Either way, you'll have to create a FormFieldFactory. In the FormFieldFactory, you can specify which types of Fields are created for each of the properties. In your case, you'll most likely want to render another form for the address field. Forms implement the Field interface, so you can have the FormFieldFactory return a Form, thus creating nested forms.

Check out the Book of Vaadin for more information about Forms and FormFieldFactories.

---

*Takes out his crystal ball* I think your next question will be how to have in a form some fields rendered horizontally side-by-side each other, for example the "city" and "zip" fields in your address pojo. The answer to this question can be found by searching the forums.

David Wall
1 decade ago Feb 18, 2010 4:26pm
Kim Leppänen
1 decade ago Feb 18, 2010 4:57pm
Hendri Thijs
1 decade ago Mar 04, 2010 9:43am
Fluffy Sandals
1 decade ago Mar 10, 2010 11:00am
Christian Carl
1 decade ago Mar 23, 2010 10:30am
Fluffy Sandals
1 decade ago Mar 24, 2010 7:05am
Christian Carl
1 decade ago Mar 24, 2010 7:35am
Fluffy Sandals
1 decade ago Mar 24, 2010 8:47am
Christian Carl
1 decade ago Mar 24, 2010 2:00pm
Fluffy Sandals
1 decade ago Mar 24, 2010 2:24pm