Form- embedded Table validation

As far as I can make out, I am able to add an editable
Table
component onto a Vaadin
Form
, by getting my FormFieldFactory to return it based on a
List
property on a
BeanItem
.

However the existing Validation mechansim from the
Form
class will only iterate through the validation of the
Validatable
Fields on the form, in the case of
Table
no specific implementation is provided to cater for this posibility.

My questions are:

  1. Is this a correct understanding of the existing validation?

  2. If I extend
    Table
    , do I have access to the Collection of
    Table
    Fields to do my own iteration?

I suppose a follow up question has to be, is there another way to do this, I don’t see it being an uncommon Use Case, esspecially as an editable Table exists in the Samper demonstrations.

Many thanks.

How do you get your List property from the item to create your embedded table? Can’t seem to get anything working from what I’ve tried.

Hi Richard!

  1. Your understanding is correct, sir.

  2. Unfortunately it looks like the collection is private (Table.visibleComponents)

Off the top of my head, you could try the following (a bit hacky – sorry):

  • make sure you provide a field factory
  • in your field factory store a reference to the fields created (make sure only the latest created field is stored)
  • iterate the fields that were stored from the fieldfactory when validating

Just remember that the the field factory will create new fields for each row and each column in the table, so the unique key for a field is the combination of the row and column.

Does anyone have a better solution?

HTH,
/Jonatan

Hi Richard

Were you able implement a table nested in a form? I need to do the same for my application but can’t find any example code for something like this. If you have done it successfully, can you show us how to do it?

Does anyone know how to do this?

Thanks,

Paul