Form Submission Drafts

You can allow your logged in customers to save a form submission as a draft and come back and edit it later. When they come back and edit the form later they can either update the draft or submit the final version.

In order to support submission drafts, your BranchCMS powered website must

  • allow customers to log in as an account holder
  • allow customers to edit the form

Accounts

You will need to set up the following app pages and their templates within the Accounts app. 

  • Login
  • Account Form List
  • Account Form Submission List
  • Account Form Submission Detail (optional)

It may also be beneficial to set up the following account app pages to complete the account user experience.

  • My Account
  • Edit My Account

Forms

You enable/disable submission draft functionality for each individual form. Follow these steps to enable submission drafts.

  1. Edit the form.
  2. Go to the Submissions tab.
  3. Set "Can public accounts view submissions for this form?" to "Yes". (This allows the form submission to show up on the Account Form List and Account Form Submission pages.)
  4. Set "Can public accounts edit their submissions for this form?" to "Yes". (This enables the submission.editUrl variable on the Account Form Submission pages.)
  5. Set the "Edit submission URL" value. This is the URL of the page that the form is on.
  6. Set "Allow draft submissions" to "Yes".
  7. Set the "Redirect url for draft submissions" value if you want to redirect the user to a different page after saving a draft than when the submit the final version.

Marking a form submission as a draft

There are two primary ways to mark a submission as a draft when saving.

1 - Show a select menu or radio button field for the user to select the submission status.

 

{% set form.submissionStatus.type = 'select' %}
{% set form.submissionStatus.options = {'complete': 'Complete', 'draft': 'Draft'} %}

<p>Submission Status: 
{{ form.submissionStatus.tag }}

2 - Use Javascript to set the hidden "submissionStatus" field value when saving.

You could have two buttons for saving the form. One that saves the form as a draft and one that submits the final version. If the button for saving the form as a draft is used then you can use Javascript to change the "submissionStatus" field value to "draft" before submitting the form.

Be sure to output the submission status field in your template. By default, it's a hidden form field.

{{ form.submissionStatus.tag }}

<script>
$('.draftBtn').on('click', function(e) {
    $('input[name="apSubmissionStatus"]').val('draft');
});
</script>

Viewing Draft Submissions

If your form is set up to allow draft submissions and at least one has been submitted, then when viewing the submissions for a form you will be able to toggle between viewing complete submissions and draft submissions.