Cert++
Close

Rendering form fields in ISML from the server form object

Key Takeaway

A template can read a form object through pdict only if the controller puts that form object in the object it passes to res.render, because each key of that object becomes a pdict property.

In B2C Commerce, a complex storefront form starts as an XML form definition. The controller turns that definition into a server-side form object and passes it to an ISML template. The template reads the form through the pdict variable. The form definition holds the fields, validation and labels, while the template holds the HTML that the customer sees.

When to use a form definition

Use a form definition when a form stores data, needs server-side validation, or has complex localization needs. A simple form that stores nothing and only needs client-side validation can be a plain HTML form.

A form definition is an XML file that lists each field and the form's actions, such as submit and cancel. For each field it gives details such as formid, label, type, mandatory and max-length.

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. 796 members and growing.