Removes page data from a form session.
This function allows a multi-page form's data to be directly modified to remove whole pages or page instances. It can only be called in the control phase of the form processing lifecycle - ie you can only use it in buttons when navigating between pages.
Typically there is a decision point on an early page that affects which pages are subsequently displayed. The user may then back-track to the decision point and change some field that renders some of the previously stored page data invalid. This function can be used to remove that invalid data from the submission.
Executed
Server-side only in the control phase.
Arguments
Argument | Type | Description | ||
---|---|---|---|---|
sessionData | String, required | The session data (will always be sessionData) | ||
pageName | String, required | The page to remove from the session data | ||
pageInstance | Integer, optional | The page instance (zero-based) to remove. If not supplied, all instances of the page will be deleted |
Example
In this example all of the data for PAGE3 will be removed if FIELD1 has the value "Yes".
function (helper, defaultPage, sessionData, defaultPageInstance) {
var theNextPage = defaultPage;
if (helper.getFieldValue('PAGE1', 'FIELD1') == 'Yes') {
helper.utilRemovePageData(sessionData, 'PAGE3');
}
return theNextPage;
}
This example removes a single instance of PAGE1:
function(helper, defaultPage, sessionData, defaultPageInstance) {
var theNextPage = defaultPage;
helper.utilRemovePageData(sessionData, 'PAGE1', 0);
return theNextPage;
}