org.apache.tapestry5

## Interface Field2

- All Superinterfaces:
    ClientElement, Field
  All Known Implementing Classes:
    AbstractField, AbstractTextField, Checkbox, Checklist, DateField, KaptchaField, Palette, PasswordField, Select, TextArea, TextField, Upload

      public interface Field2
      extends Field

  Due to how control names and client ids are allocated inside during an Ajax request, it is difficult to to connect input data and field validation errors to the fields, since the control name and client id are different during the processing of the submitted form data and during the subsequent render. Starting in 5.4, the key used to identify a field inside the org.apache.tapestry5.ValidationTracker is this new validation id, which is assigned on first read.

  If a field inplements {@link org.apache.tapestry5.Field} but not Field2, then the control name is used as the validation id (which will work correctly during non-Ajax requests).

  This assumes a "flat" field structure, where a given component renders only once (not multiple times, inside a {@link org.apache.tapestry5.corelib.components.Loop}.
  Since:
    5.4

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `getValidationId()` Returns a request-scoped unique validation id for the field.

    - ### Methods inherited from interface org.apache.tapestry5.Field

      `getControlName, getLabel, isDisabled, isRequired`

    - ### Methods inherited from interface org.apache.tapestry5.ClientElement

      `getClientId`

- - ### Method Detail

    - #### getValidationId

          String getValidationId()

      Returns a request-scoped unique validation id for the field. This returns the same value regardless of how many times the field is rendered, which means that the behavior will be incorrect when the field component is placed inside a loop.

${project.version} - Copyright © 2003-2014 The Apache Software Foundation.