Creating a Form Definition

Use a form definition to define the browser form elements, including actions and how they are validated. The form definition provides Salesforce B2C Commerce with rules on how to populate the in-memory data that is rendered on the browser.

The SiteGenesis application comes with a set of form definitions, contained in the forms folder.

  1. Open Studio.
  2. Create a form definition with your storefront's cartridge structure, for example, sendstuff.xml, as follows:
    <?xml version="1.0"?>
    <form>
    	<field formid="catalog" label="forms.sendstuff.010" type="boolean" binding="profile.catalogSend" />
    	<field formid="email" label="forms.sendstuff.011" type="boolean" binding="profile.emailSend" /> 
    	<action formid="apply" valid-form="true" /> 
    </form>

    This form definition specifies the two optional fields as boolean and an Apply button.

  3. Continue with this example: Using Forms in Templates.