Vaadin Flow Question

I want to display a User Registration page where a new user can register on a site. The registration page contains the usual fields. Upon clicking the Submit button, I want to validate the information, and if all is valid, the user should see their personal home page, but if validations fail, they should stay on the registration page, the input fields remain as they were before clicking Submit, but the validation messages will appear. What java code is needed to provide this navigation?

Thanks for any help on this.

Hey.
Sounds like you can use Binder api to achieve the desired functionality: https://vaadin.com/docs/v11/flow/binding-data/tutorial-flow-components-binder.html (see also next chapters for validation examples)

What you will need to do is to bind the fields you want to validate and on a Submit button press you check that the validation passes before redirecting to the other page.

Thank you, the binder info will be helpful. But it is the routing information I am trying to resolve right now. How do I redirect from the register page to the user’s Home Page? And how do I redisplay the Register page if there are errors on it?
Note, when I redirect to the user’s private HomePage, I will need to know what user is logged in so I can show their specific information.

Hi Stephen,

For routing, beforeLeaveEvent and beforeEnterEvent might be of help to you:

https://vaadin.com/docs/v11/flow/routing/tutorial-routing-lifecycle.html