Handling two ComboBoxes in Vaadin

This post is a solution to a problem I faced developing an application in Vaadin. It is related to handling two ComboBoxes in Vaadin, where the values in the second ComboBox depend on the selection of the first ComboBox

Handling two ComboBoxes in Vaadin

The Vaadin form component is easily handled and rendered with a FormFieldFactory. So I have a Form called MusicForm

Here is the FormFieldFactory code:

The key here is to add the comboBox as a field in the uiContext which eventually is of type MusicForm.

When the user selects a value form the music type comboBox the value change listener is triggered and it adds the sons comboBox in the uiContext at the appropriate position.
Hope this helps. Stay connected and stay Subscribed