Cert++
Close

Form definition XML elements and field types

Key Takeaway

A field's type decides which form definition rules validate it on the server. Length and regex checks validate only string fields, and minimum and maximum values apply only to int, number, and date fields.

A form definition is an XML file that describes the fields a storefront form collects, how each field is validated, and where the data is stored. B2C Commerce turns the file into an in-memory form object. Controllers and templates use that object to read, validate, localize, and save customer input on the server.

When to use a form definition

Use a form definition for a complex form that stores data, needs server-side validation, or needs sophisticated localization, such as adding, removing, or rearranging fields per locale. A simple form that stores nothing and needs only client-side validation can be a standard HTML form instead.

B2C Commerce Developer Study Guide

Checklist progress

0/237Learned

Given a requirement to accept, validate, and persist information from a storefront customer, modify the appearance of a form, add validation and cross-site request forgery (CSRF) protection, and use bindings to process fields

0/9

Prepare for the Exam

Play Today's Certle

Study Community

Ask questions and get the latest info from other B2C Commerce Developer studiers.