You can create HTML forms in B2C Commerce using templates and controllers. Using form definitions, you can also persist form data during a session and store it in system objects or custom objects.
route:BeforeComplete
event is used to store form data. Different APIs are used to save data, depending on the type of form. server.getForms
function to get the form data structure from the relevant form definition and convert it into a JSON object. The object is then added to the data passed to the template, so that it's available to the template via the pdict
variable. To clear the form, you must manually call the clear
method.ViewData
object used for rendering the template. The server
module in the modules
folder includes a forms.js
module that converts form data into JSON objects. For more information, see the following functions in the server-side JSDoc.© Copyright 2000-2023, Salesforce, Inc. All rights reserved. Various trademarks held by their respective owners. |
Show URL | Submit Feedback | Privacy Policy |