Add a standalone text in a Form

Hi all,
I’m wondering if there is a way to show some informational text in a form. This text is not bind to any property in the bean, it’s just text and it only purpose it to inform the user of proper filling the form.

I’ve created a Label and in it’s caption I’ve putted the text I wanted, but then in the createField there is no propertyId for this text in order to be created.


public class MyForm extends Form {
          public SchoolQuestionnaireForm(DastagdApplication app) {
               [..]

               setFormFieldFactory(new DefaultFieldFactory() {
                      @Override
                      public Field createField(Item item, Object propertyId, Component uiContext) {

                     }
              }
         }
}

I’m almost sure that some concepts of Vaadin skipped my understanding… I don’t know…

Any help would be appreciated!
cheers :slight_smile:
Natasa

Hi,

As mentioned in the
Book Of Vaadin chapter on Forms
you can display some informational text on a form via form#setDescription(String)

Cheers,

Charles.

Hi Charles,
Thanks for the reply!

I’ve already used the method form#setDescription(String) but unfortunatelly there are several informational texts that should be displayed in the form. Generally asking, is there a way other than using the methods form#setDescription(String), form#setCaption(String) to display some text (which is not bind to a property) in the form?

Thanks anyway,
Natasa

Generally speaking, No!

A Vaadin Form typically has

Description
Caption: Field
Caption: Field
Caption: Field

Anything outside of that you’ll need to create the layout yourself… which should be easy enough to do.

Cheers,

Charles.

Nice idea Charles! I’ll build a layout as you suggested.

Thanks again for the clarification!

Cheers,
Natasa