Form and two ComboBoxes (one fitering the other)

hi guys,

I think theres some knot in my head I just can not figure out a solution for the following problem:

I would like to use a BeanItemContainer and a Form to display and edit information of a Song like shown in the attached simple_edit_song.png.
When the user selects an artist in combobox “Artist” I want to show only records of this artist in the combobox “Record”.
I do know how to achive that behavior without a Form and a BeanItemContainer but i was wondering if there is a way to use them.

I do not have any code for this because I need a solution for that problem in a larger more complex project and thought that it might be less confusing with this simple example.

Anyone who can help with that?

Thanks in advance!
12649.png

Which Vaadin version would you like to use (7 or 6)? If 6 you can look a bit into my simple application where I had faced with problems like complex form with tabs and validation, application working on few tabs in browser without session connection problem, CRUD with SQLContainer, global variables to each session and few more things.

You can find that project on github →
https://github.com/nonameplum/HelloWorld

For you the most interesting parts would be:

https://github.com/nonameplum/HelloWorld/blob/master/src/com/example/helloworld/ComplexForm.java


https://github.com/nonameplum/HelloWorld/blob/master/src/com/example/helloworld/KontrahFieldFactory.java


https://github.com/nonameplum/HelloWorld/blob/master/src/com/example/helloworld/KontrahComposition.java

In my case I’m using only one combobox but I don’t see major problems that not allow to achieve your requirements.

Best regards.

In Vaadin 6 you could use a custom FieldFactory on a form, and filter the second Select component on ValueChange in the first. In Vaadin7, you can do the same thig, but without the FieldFactory (create the fields yourself).

Hey guys,

thank you for your help. I am using vaadin 6 and I have achieved my goal using the
customfield addon
because it allows me to use a FieldFactory to put a new custom made field instead of the “record” property into the Form.

I just followed the
demo
of the addon.

Thanks!