(Quick Reference)

field

Purpose

Adds a Vaadin Field to the parent container.

Examples

// Within a form
<v:form bean="${bookInstance}" writeThrough="false">
  <v:field name="title" readOnly="false" required="true" requiredError="Please enter a Title">
    Title
  </v:field>
  <v:field name="author" readOnly="false" required="true" requiredError="Please enter an Author">
    Author
  </v:field>
  <v:field name="description" readOnly="false" required="false"/>
    Description
  </v:field>
</v:form>

// Standalone <v:field>My Field</v:field>

Description

A field can be created within a Form, or standalone.

Unless the type attribute is explicitly specified, the type of component that is created for the field is automatically selected based on the type of the underlying property in the form data source.

Body

  • Contains the caption for the field

Attributes

Specific
  • name (optional) The property name of the field
  • caption (optional) The caption of the field. Overrides the body content.
  • type (optional) The class (or its fully-qualified name) of the Vaadin Component to use for the field, or a recognised short type-name: date, checkBox, comboBox, listSelect, optionGroup, password, select, text, textArea, upload, file, customField
  • onValueChange (optional) Either a ValueChangeListener or a Closure that takes a ValueChangeEvent parameter

General
  • var (optional) Uses Grails's set tag to set the value of the specified variable to be this component.
  • class (optional) The CSS class name to add to the component using the addStyleName() method
  • sizeUndefined (optional) Calls setSizeUndefined() on the component. (Attribute value is ignored)
  • sizeFull (optional) Calls setSizeFull() on the component. (Attribute value is ignored)

See Vaadin Field API docs for full list of allowed attributes.