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, IValidationDelegate
Parameters
Name | Type | Direction | Required | Default | Description |
---|---|---|---|---|---|
method | string | in | no | post | Method used by the form when it is submitted. |
success | IActionListener | in | 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 | in | no | Listener used when a form is cancelled, overriding the default listener. Forms are cancelled by invoking the client-side JavaScript function document.form-name.events.cancel(). A cancelled form does not rewind. If no cancel listener is provided, then the normal listener will be used. | |
refresh | IActionListener | in | 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. | |
listener | IActionListener | in | 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 | in | 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. |
direct | boolean | in | no | true | If true (the default), then the more efficient direct service is used. If false, then the action service is used. The action service requires rewinding of the entire page, and is rarely (if ever) used. |
delegate | IValidationDelegate | in | 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 | in | no | false | If true, then client-side validation will be enabled for components that support it (such as TextField). |
focus | boolean | in | 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. |
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. The older validation system, centered around the ValidField component, still requires that clientScriptingEnabled be set on individual IValidators.