Clear Draft
Audience:
Low-code EngineersSkill Prerequisites:
Actions,Forms 2.0
Removes the automatically saved draft of a Forms 2.0 form, so the form opens normally the next time it loads. Use it after the form's data has been saved, so a finished submission doesn't come back as a draft.
This action is only available in Forms 2.0. It only does something when the form has Enable Auto Save Drafts turned on. See Settings.
Typical Use Cases
- Clear the draft after a Submit button has saved the data
- Add a Discard draft button that throws away the user's unsaved answers. A Cancel button already does this on its own.
- Clear the draft of another form on the same page, for example a form in a popup
Don't use it to
- Reset the fields on screen. Clearing the draft doesn't change what the form shows. Use Refresh Field Data, or reload the form.
- Delete data saved on the server. A draft lives only in the user's browser.
Related Actions
| Action Name | Description |
|---|---|
| Run SQL Query | Saves the form's data, usually just before this action. |
| Ask for Confirmation | Asks the user before a Discard draft button clears their answers. |
| Refresh Field Data | Changes the values shown in the form. |
Input Parameter Reference
| Parameter | Description | Supports Tokens | Default | Required |
|---|---|---|---|---|
| Select Form | The Form module whose draft to clear. It must be on the current page. Pick it from the list, or use a token or expression that gives the module ID or its GUID. | Yes | empty | Yes |
| Continue Execution | When checked, the actions after this one run. When unchecked, this action ends the action list. | No | False | No |
How drafts work
When Enable Auto Save Drafts is on, the form saves the user's answers in their browser's local storage about half a second after each change, and again when they leave the page. A small status next to the form shows Saving…, Saved, or Not saved if the browser's storage is full or blocked.
When the user opens the form again, the saved answers replace the values the form would normally load. This works for all fields, including the entries of a Repeater.
A draft is kept until Clear Draft removes it, with one exception: a button whose Button Type is Cancel removes the draft by itself after its actions run. Primary and Regular buttons don't, so add Clear Draft to them. See Saving Drafts for more.
Considerations
- Put it after the save. If the save fails and ends the actions, the draft is kept, so the user doesn't lose their answers.
- One draft per form and user. The draft belongs to the form module and the user, or to the browser for a visitor who isn't logged in. It doesn't depend on the URL. If the same form edits different records, for example
?OrderId=5and?OrderId=7, the draft of one record is loaded into the other. Clear the draft after every save, or don't turn on drafts for edit forms. - Autosave stops until the form reloads. After the draft is cleared, further changes on the same page aren't saved as a new draft until the form is loaded again.
- Only on this browser. The draft is stored in the user's browser, so it isn't shown on another device or browser, and it's lost if the user clears their browser data.
- No draft, no effect. If drafts are off for the form, or there's no draft, the action does nothing.
- The form must be on the page. If Select Form isn't a module on the current page, the action fails with
There was an error clearing the form draft.A value that isn't a number or a GUID fails withCould not determine ModuleId to execute the action. - Conditions. To clear the draft only in some cases, give it a condition. See Common Parameters.
Examples
To understand how to use the below examples, please see Running Examples.
1. Clear the draft after saving
Add this action to the form's Submit button, after the action that saves the data. Form module 1234 is the form itself. Continue Execution is on, so a redirect or message after it still runs.
{
"Title": "Clear Draft",
"ActionType": "ClearFormDraft.Csp",
"Description": "Remove the draft once the data is saved",
"Parameters": {
"ModuleId": "1234",
"ContinueExecution": true
}
}
Revised 11/18/2026