Form

A Form component must enclose the other form element components (such as TextField and Checkbox ). It manages the rendering of the form as well as processing when the form is submitted (known as "rewinding" the form). In traditional web applications, the developer is responsible for providing a name for each form and each form control element; in Tapestry, the Form component generates its own unique name, and unique names for each enclosed component ... this is necessary to support advanced features such as loops within forms.

See also: org.apache.tapestry.form.Form , Validation

Parameters

Name Type Required Default Description
method string no post Method used by the form when it is submitted.
success IActionListener no Listener invoked when the form is submitted normally (not a cancel or a refresh) and the validation delegate indicates no errors. If the delegate indicates errors, then the listener parameter (if non-null) is used instead.
cancel IActionListener no Listener used when a form is cancelled, overriding the default listener. Forms are cancelled by invoking the client-side JavaScript function document.



tapestry.form.cancel(formId || form element, submitName)

A cancelled form does not rewind. If no cancel listener is provided, then the normal listener will be used.



See also: Form JavaScript API
refresh IActionListener no Listener used when a form is refreshed, overriding the default listener. A refreshed form bypasses input field validation on the client side, though validation still occurs on the server side. If no refresh listener is provided, then the normal listener will be used.



See also: Form JavaScript API
listener IActionListener no Default listener to be invoked when the form is submitted. Invoked only if another listener (success, cancel or refresh) is not invoked.
stateful boolean no true If true (the default), then an active session is required when the form is submitted, if there was an active session when the form was rendered.
delegate IValidationDelegate no default instance An object that tracks user input and input field errors, and decorates fields and field labels. This is typically overriden to provide an application-specific look and feel.
clientValidationEnabled boolean no false If true, then client-side validation will be enabled for components that support it (such as TextField ).



See also: Client Side Validation
focus boolean no true If true (the default), the the Form will determine a field to receive input focus, and add JavaScript to move the cursor to that field. Priority is given to fields in error, then required fields, then any non-disabled field. On a page with multiple forms, use this parameter to control which form will take focus.
scheme String no The required scheme ("http" or "https", typically) for the URL. This will force the creation of an absolute URL when the current request's scheme does not match the value for this parameter. This is most often used to switch to "https" for secure portions of an application (such as a login page), before switching back to standard "http" for the majority of an application.
port Integer no The required port (80, 443, 8080. 8443, typically) for the URL. This will force the creation of an absolute URL when the current request's scheme does not match the value for this parameter. This is most often used in conjunction with scheme to switch to "https:443"/"https:8443" for secure portions of an application (such as a login page), before switching back to standard "http:80"/"http:80" for the majority of an application.
updateComponents String[],Collection no In an asynchronous request, specifies which components should have their content rendered back to the client. These are expected to be unique component ids.

See: ResponseBuilder



See also: Ajax Features
json boolean no false Causes the request to be asynchronous and the response to be captured/rendered via the JSONResponseBuilder renderer.



See also: Ajax Features
async boolean no false Causes the request to be asynchronous and the response to be captured/rendered via the DojoAjaxResponseBuilder renderer.



See also: Ajax Features

Body: allowed

Informal parameters: allowed

Reserved parameters: action, enctype, id, name, onreset, onsubmit

A note about clientValidationEnabled: This refers to the revamped input validation support that debuts in Tapestry 4.0.