Interface FormSupport

    • 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.