Working with Forms

Forms are used for collecting requests from users of a website. We'll learn how to create various forms with different fields.

In this chapter, we will cover:

  • Creating a simple form

  • Generating fields from a bean

  • Binding fields to a bean

  • Using field validation

  • Using bean validation

  • Creating a custom validation

  • Creating a CRUD form

  • Filtering items using ComboBox


We'll start with creating a simple login form. Then we'll show how to create a form very quickly and easily by generating fields from a bean. Validation of the user input is very important in each application. In Vaadin, we can check values on the fields, we can use JSR-303 (Java Specification Request) validation, or we can create our own custom validator. So we'll look more deeply at these validation techniques. Next we'll create a form that is based on the CRUD concept. Create, read, update, and delete (CRUD) are the four basic functions of storage. Finally, we'll learn how to use the ComboBox component to filter items.