What Is a Form Definition
When working with Salesforce B2C Commerce forms, you define form properties and data validation within an XML-based form definition (model). Form definitions are stored in the forms folder of a cartridge (cartridge/forms/default). Within a pipeline, you use form pipelets to create in-memory data constructs based on one or more form definitions.
The form.xsd schema file (XSD), which identifies the allowed elements and attributes for form files, is included in the general schema .zip file provided by B2C Commerce.
Use this file as a guideline for defining your form definitions.
The Pipeline Dictionary stores per session key value pairs using elements of the form definition as the keys and consumer input data as the values. You can also use forms just for rendering. They don't need to contain consumer input data.
There is only one form instance for each form definition per session.
The system stores this information in the Pipeline Dictionary using the
value CurrentForms
to provide access to these form
instances. You can reference a form within a template or script via its
definition name, which is derived from its file name. You can access all
form fields as alias expressions and as B2C Commerce script expressions; and
use these expressions to copy (via binding) the value of a field directly
into a business object.
Form definitions |
|
Form objects (in memory) |
|
Refer to a form instance by the form definition's XML file name, as follows:
CurrentForms.<formname>.<field(s)>
These are some sample expressions:
name="${pdict.CurrentForms.cart.CalculateTotal.htmlName}"/>
<isif condition="${pdict.CurrentForms.checkout.selectedpm.options.CreditCard.checked}">