Actions

After the input values passed all the pre-configured single-field and multiple-field validation rules, the corresponding action is executed and may perform final checks on the input data. If they are successful, the properties are committed: their values are stored in the corresponding form data (assuming you didn't turn on the auto-commit feature).

The module's de.odysseus.calyxo.forms.FormsSupport instance serves as a central point for actions to interact with Calyxo Forms. Everything starts by getting a reference to the FormsSupport instance:

FormsSupport support = FormsSupport.getInstance(request);

The FormsSupport instance offers you the following methods:

public FormProperties getFormProperties(HttpServletRequest request, String action)
Returns the form properties (of type de.odysseus.calyxo.forms.FormProperties) for the specified request and action.
getFormData(HttpServletRequest request, String action, boolean create)
Returns the form data (of type de.odysseus.calyxo.forms.FormData) for the specified request and action. (If there is none and the create flag is set to true, an appropriate one is created.)
removeFormData(HttpServletRequest request, String action)
Removes the form data for the specified request and action.
getFormResult(HttpServletRequest request, String action)
Returns the form result (of type de.odysseus.calyxo.forms.FormResult) for the specified request and action.

Form Properties

An instance of de.odysseus.calyxo.forms.FormProperties gives access to the validated (and converted) input values via its getProperty(String name) method:

FormProperties properties = support.getFormProperties(request, "/foo");
Date arrival = (Date)properties.getProperty("arrival");

Depending on your environment, there may be action base classes, which do this step for you and pass the form properties to as a parameter to you action execution method. See the Integration section for further details.

After performing all additional checks on the input values, the commit() method allows you to store them in the form data:

properties.commit();

Form Data

When valid form properties are commited, they are used to populate a form data instance.

The de.odysseus.calyxo.forms.FormData interface provides the methods _getProperty(String name) and _setProperty(String name, Object value) to access its properties.

The FormsSupport instance provides methods to access, remove or re-create saved form data for some action. This is useful if you want to initialize form data before (re)displaying the form:

FormData data = support.getFormData(request, "/checkin", true);
data._setProperty("arrival", new Date());

The way how form data is associated with your actions varies, depending on your environment. See the Integration section for further details.