FieldLabel
A FieldLabel works with a ValidField or other 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 (if a ValidField), 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. |
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), and a ValidField being labeled (with the displayName being provided by the ValidField, from its 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>