Group Form Element

The <group> element is a container in which you can define other form elements. It also acts as a property to which to which you can map a business object. When you define form elements in a group, you can refer to the group and then an element within it from a pipelet or a script. The <group> element is represented by the dw.web.FormGroup API class.

Attribute Description
formid The identifier of the group (required).
binding If a business object is assigned to the group, the property name to read the value out of the business object or to set. Also used by the pipelets UpdateFormWithObject and UpdateObjectWithForm.
description Optional descriptive text for the user interface. For example, "Address Information".
form-error The error message to use for group container. If the container is considered invalid, this is the error message that is set on the container. See the pipelet invalidateFormElement.
object-def The value of object-def must be the name of a business object, for example, CustomerAddress, or the name of custom business object that is prefixed with Custom (for example, Custom.MyObject).
validation Salesforce B2C Commerce script expression that resolves to a custom validation function provided by a B2C Commerce Script Module. The referenced function can return a dw.web.FormElementValidationResult object. The form-error attribute specifies a generic error message that is used whenever your validation function returns false (that is, if the FormElementValidationResult.isValid() method evaluates to false). The validation attribute was added in version 16.1.

The <group> element can contain:

  • Other <group> elements
  • <field> elements
  • <action> elements
  • <include> elements
  • <list> elements

Example:

The following shows a group element in the paymentinstruments form:

<group formid="creditcards">
	<list formid="storedcards">
		<include formid="card" name="creditcard"/>
		<action formid="remove" label="forms.paymentinstruments.001" valid-form="false"/>
	</list>
	<include formid="newcreditcard" name="creditcard"/>
	<action formid="create" valid-form="true"/>
</group>