How to collect form input with many fields without binder

Hi I am new to Vaadin, recently I tried to bind a complex object with binder and found it was not that easy.
I’m wondering if we have a form with many fields and I’d like to collect all those fields and save to the DB, if I don’t use binder, if this doable?

Thanks for sharing your thoughts.

Yes you could manually collect the values from all your inputs, (eventually convert and) validate them all manually, fill your object with those values yourself, and then save it to the DB. With this you aren’t necessarily making it easier though. I would recommend to [read more about databinding with Binder]
(https://vaadin.com/docs/v14/flow/binding-data/tutorial-flow-components-binder.html), look at the respective [forms and databinding tutorial]
(https://vaadin.com/learn/training/v14-forms) (If you have access to the training tutorials), or look at existing starter projects online.

Using Binder has many advantages like field validation, object validation, type converters, and less code overall. Learning how to use the Binder will definitely pay off in the long run.

Thanks you @Kaspar Scherrer
I’ve read https://vaadin.com/docs/v14/flow/binding-data/tutorial-flow-components-binder.html and still trying to find away to understand the the detail to use the binder with my business object.

I try to download the bakery store front from the official site to learn, but looks like the example use many Pro components and not easy to learn. :slight_smile:

Be aware that in the linked docs, there are further pages that are about the Binder, for example [Binding Beans to Forms]
(https://vaadin.com/docs/v14/flow/binding-data/tutorial-flow-components-binder-beans.html), [Loading From and Saving To Business Objects]
(https://vaadin.com/docs/v14/flow/binding-data/tutorial-flow-components-binder-load.html), and [Validating and Converting User Input]
(https://vaadin.com/docs/v14/flow/binding-data/tutorial-flow-components-binder-validation.html) (last one is probably too advanced for your initial steps. For a working first stage of your form, you probably wont need validators and converters). These should help you for your task.

And yes the bakery store front does have some pro components, but you don’t have to look at the whole application but only the parts where Binders are used.

I’d recommend to just try out what is described in above links with your own business object.