Clearing or Refreshing a Form

In SFRA, you use the 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.

Example:

This example gets the profile form and clears it.

function (req, res, next) {
    var accountModel = getModel(req);
    var profileForm = server.forms.getForm('profile'); //gets the profile form object 
    profileForm.clear();              //clears the form using a function from the server module forms.js