FieldLabel

A FieldLabel works with form element components (such as TextField , TextArea , Checkbox , etc.), labeling the field with the displayName property of the field. The FieldLabel may also be decorated by the validation delegate (to highlight when the corresponding field is in error).

The body of the component is discarded, but often has a provisional label (for WYSIWYG). The actual value is typically provided by the field (so that it may be localized just once).

See also: org.apache.tapestry.valid.FieldLabel , IValidationDelegate

Parameters

Name Type Direction Required Default Description
field IFormComponent in yes The component to be labeled. The component will be pre-rendered by the FieldLabel, and its displayName property used as the label string (note that most form element components return null for displayName).
displayName String in no Overrides the displayName provided by the component or supplies a displayName for components (such as TextField , etc.) that don't provide one. A runtime exception occurs if displayName is null and not supplied by the component.
raw boolean in no false If true, then the displayName is printed "raw" (without filtering), which is appropriate when the displayName includes markup text.
prerender boolean in no true If true (the default), then the field for this label is pre-renderered. This is necessary so that the field can render itself, and set its client id (which is needed for the FieldLabel to render). When the FieldLabel is positioned after the field, prerender should be set to false.

Body: removed

Informal parameters: allowed

Reserved parameters: for

Examples

FieldLabel components are simple, and generally expressed entirely in the HTML template. Here we see a TextField being labeled (and the displayName being provided as a FieldLabel parameter).

<tr>
  <th>
    <span jwcid="@FieldLabel" field="component:textField" displayName="message:textfield-label">Text Field</span>:
  </th>
  <td>
    <input jwcid="textField@TextField" . . . />
  </td>
</tr>
<tr>
  <th>
    <span jwcid="@FieldLabel" field="component:validField">Valid Field</span>:
  </th>
  <td>
    <input jwcid="validField@ValidField" displayName="message:validfield-label" . . . />
  </td>
</tr>