Cert++
Close

Locale-specific form definitions for differing form structure

Key Takeaway

To give a locale its own form structure, save a form definition with the default's file name in a folder named for that locale (forms/<locale>/<formname>.xml). Then add strings for all of its fields to that locale's forms properties file, and configure the locale for the site in Business Manager.

Some forms need different fields in different countries. In B2C Commerce, you give each locale its own version of the form definition. A locale without its own version uses the default one. Translated labels and error messages come from properties files, so you handle them separately from the form's structure.

What a form definition is

Each form definition sets the structure of an in-memory form object. The form object persists during the session unless you clear it.

Not every form needs a form definition. Choose based on what the form must do:

If the form stores data, needs server-side validation, or has sophisticated localization needs...

The form is a complex form, so use a form definition.

If the form stores no data, is easily localized, and needs only client-side validation...

A standard HTML form is a better fit.

Sophisticated localization means adding, removing or rearranging fields, or changing the data object that stores the form data. Changing a form's fields by locale falls into this group, so a locale-specific form structure calls for form definitions.

B2C Commerce Developer Study Guide

Checklist progress

0/237Learned

Given localization requirements, implement and enhance templates, form definitions, static files, properties files, and persistent object attributes to ensure that pages are displayed in the expected language

0/8

Prepare for the Exam

Play Today's Certle

Study Community

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