Required table in a form

I am trying to make a required table in a form. i want the red * to appear next to the table’s caption in the form.

Here is my code:

protected void init(VaadinRequest request) {
final FormLayout layout = new FormLayout();

    Table table = new Table("Caption goes here");
    TextField tf = new TextField("Caption goes here");

[/code]I expected a red * to appear next to the caption, like it does for the TextField.

What is wrong and how do I fix it?

Environment: Java 7, Vaadin 7.4.5, Eclipse.


This could be considered a bug and

The reason seems to be that only field components can be required, but Table’s connector extends AbstractHasComponentsConnector instead of AbstractFieldConnector. Client-side classes like VCaption and many others check that for a component to be required, its connector must extend AbstractFieldConnector or its state AbstractFieldState.

There’s probably a good reason to extend AbstractHasComponentsConnector, so it could be hard to fix. Oh my, it looks that also TouchKit relies on the same assumption.

An easy workaround is to add an indicator with CSS. Add a “customrequired” style for the table and have something like:

.v-caption-customrequired .v-captiontext:after {
    color: red;
    content: "*";

I have logged the issue at: