Action Form Element

The <action> element lets you specify a possible action for the form, for example, the Apply button. It is represented by the dw.web.FormAction API class.

Attribute Description
formid The identifier of the action.
label An optional descriptive label for the field. This field can be a key.
valid-form Controls if the form is validated: "true" or "false".
description Describes what the action does.
binding Used to associate an object with an action. For example, in a list, each row can have a delete button. The binding helps identify which delete button was clicked.
validation Salesforce B2C Commerce script expression that resolves to a custom validation function provided by a B2C Commerce Script Module. The referenced function must return a dw.web.FormElementValidationResult object. The validation attribute was added in version 16.1.

Certain ID values are reserved, such as "continue" and "delete". For example, the following not compiles:

<action formid="continue" valid-form="true"/>

Example

This shows the action element, calculateTotal in the cart form, which represents the Calculate Total button on the browser.

<action formid="calculateTotal" valid-form="false"/>