All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.tapestry5.corelib.components.Form.xdoc Maven / Gradle / Ivy

Go to download

Central module for Tapestry, containing interfaces to the Java Servlet API and all core services and components.

There is a newer version: 5.8.6
Show newest version

    

        

The following components are Tapestry wrappers around client-side HTML form elements:

Examples of the Form component are provided in the many other pages that discuss specific form control element components, such as Radio andTextField.

The Form component generates a seemingly bewildering number of events, designed to address a wide range of needs. The goal is to give you as the developer the tools necessary to effeciently manage state.

All of the events that are triggered will pass along the values defined by the context parameter. Most often, there is no context, or the context is a single value (a primary key used to identify the object being updated by the form).

Render event handler methods should not return a value, doing so will be an error. The methods are intended to allow the page to convert a primary key stored in the context back into an object ready to have its properties updated by the Form.

The context passed to component event handler methods is provided by reading the context parameter.

  • prepareForRender
  • prepare

Submit events may return a navigational value, which will abort any remaining processing of the form submission.

The context provided to component event handler methods originates in the form submission (it is stored in hidden form fields); the context parameter is not read during a form submission.

  • prepareForSubmit
  • prepare
  • validate
  • validateForm (deprecated)
  • failure or success
  • submit

The validate event is to allow the page to perform cross-field validation. The validateForm event is a deprecated name for the validate event (it currently exists only for backwards compatibility). The failure or success event is fired based on whether there are or are not any validation errors.

It is considered a best practice to give explicit ids to Form components, and form control element components. These ids propagate down to the client side as element names and/or ids, and eventually show up as query parameters when the form is submitted.

To achieve a more RESTful URL scheme, give the form component an id based on what it does rather than what data it updates, thus ]]> rather than ]]> or ]]>.





© 2015 - 2024 Weber Informatics LLC | Privacy Policy