Package org.apache.tapestry5.services

## Interface FormSupport

- All Superinterfaces:
    `ClientElement`
  All Known Subinterfaces:
    `InternalFormSupport`
  All Known Implementing Classes:
    `FormSupportAdapter`, `FormSupportImpl`

      public interface FormSupport
      extends ClientElement

  Services provided by an enclosing Form control component to the various form element components it encloses. Implements `ClientElement`, to share the id of the enclosing form.
  See Also:
    `Field`

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `addValidation​(Field field, String validationName, String message, Object constraint)` | Deprecated. Deprecated in 5.4 with no exact replacement; this default implementation now does nothing.
    `String` | `allocateControlName​(String id)` | Allocates a unique (within the form) control name for some enclosed component, based on the component's id.
    `void` | `defer​(Runnable command)` | Defers a command until the end of the form submission.
    `String` | `getFormComponentId()` | Returns the complete id of the underlying Form component.
    `String` | `getFormValidationId()` | Id used as a prefix when searching `Messages` for validation messages and constraints.
    `boolean` | `isClientValidationEnabled()` | Return true if client validation is enabled for this form, false otherwise.
    `void` | `setEncodingType​(String encodingType)` | Sets the encoding type for the Form.
    `<T> void` | `store​(T component, ComponentAction<T> action)` | Stores an action for execution during a later request.
    `<T> void` | `storeAndExecute​(T component, ComponentAction<T> action)` | As with `store(Object, org.apache.tapestry5.ComponentAction)`}, but the action is also invoked immediately.
    `<T> void` | `storeCancel​(T component, ComponentAction<T> action)` | Stores an action for execution in a later request when the containing form is canceled.

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

      `getClientId`

- - ### Method Detail

    - #### allocateControlName

          String allocateControlName​(String id)

      Allocates a unique (within the form) control name for some enclosed component, based on the component's id.
      Parameters:
        `id` - the component's id
      Returns:
        a unique string, usually the component's id, but sometime extended with a unique number or string

    - #### store

          <T> void store​(T component,
                         ComponentAction<T> action)

      Stores an action for execution during a later request. If the action contains any mutable state, it should be in its final state before invoking this method and its internal state should not be changed subsequently.

    - #### storeCancel

          <T> void storeCancel​(T component,
                               ComponentAction<T> action)

      Stores an action for execution in a later request when the containing form is canceled. Cancel actions are triggered before the form fires its `EventConstants.CANCELED` event.
      Since:
        5.4

    - #### storeAndExecute

          <T> void storeAndExecute​(T component,
                                   ComponentAction<T> action)

      As with `store(Object, org.apache.tapestry5.ComponentAction)`}, but the action is also invoked immediately. This is useful for defining an action that should occur symmetrically in both the render request and the form submission's action request.
      Parameters:
        `component` - component against which to trigger the action
        `action` - the action that will be triggered (and passed the component)

    - #### defer

          void defer​(Runnable command)

      Defers a command until the end of the form submission. The command will be executed before the Form's validate notification, but after all other submit actions for the form have been processed. This is used, primarily, to coordinate validations or other operations that involve multiple components, when the order of the components can not be determined. During a form render, runnables are executed after the body of the form has rendered.
      Parameters:
        `command` - to be executed

    - #### setEncodingType

          void setEncodingType​(String encodingType)

      Sets the encoding type for the Form. This should only be set once, and if
      Parameters:
        `encodingType` - MIME type indicating type of encoding for the form
      Throws:
        `IllegalStateException` - if the encoding type has already been set to a value different than the supplied

    - #### addValidation

          void addValidation​(Field field,
                             String validationName,
                             String message,
                             Object constraint)

      Deprecated.
      Deprecated in 5.4 with no exact replacement; this default implementation now does nothing. Invoke `isClientValidationEnabled()`, and (if true), use `JavaScriptSupport` to add necessary modules, and add triggering and configuring attributes to the field's `Element`.
      Collects field validation information. A Form may turn off client-side validation, in which case these calls will be ignored.
      Parameters:
        `field` - for which validation is being generated
        `validationName` - name of validation method (see Tapestry.Validation in tapestry.js)
        `message` - the error message to display if the field is invalid
        `constraint` - additional constraint value, or null for validations that don't require a constraint

    - #### isClientValidationEnabled

          boolean isClientValidationEnabled()

      Return true if client validation is enabled for this form, false otherwise.

    - #### getFormComponentId

          String getFormComponentId()

      Returns the complete id of the underlying Form component.

    - #### getFormValidationId

          String getFormValidationId()

      Id used as a prefix when searching `Messages` for validation messages and constraints. This is normally the simple id of the form.
      Returns:
        validation id string
      See Also:
        `FieldTranslatorSource`, `FieldValidatorSource`