Skip to content

Commit

Permalink
Make pre-submit privacy agreement more generic and configurable (usds…
Browse files Browse the repository at this point in the history
…#209)

* Make pre-submit privacy agreement more generic and configurable
* Make preSubmit field name configurable; fix unit tests
* Remove debugging; add docs
* Fix second unit test with orphaned expect()
* Fix failing unit test
* Add test case for when preSubmitInfo isn't specified

(cherry picked from commit d3cd6f0)
  • Loading branch information
dmethvin-gov committed Sep 20, 2018
1 parent b3dcc5e commit db029cb
Show file tree
Hide file tree
Showing 26 changed files with 313 additions and 182 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,17 @@ For the code implementation, see the [`review` folder](../../src/js/review).

### Required checkbox before form submission

Use this feature to require a user to indicate they have read terms and conditions, a privacy policy, or any other text before submitting your form. This includes a checkbox and short-form text that can include relevant links to more verbose text on separate pages on your site.
Use this feature to require a user to indicate they have read terms and conditions, a privacy policy, or any other text before submitting your form. It includes a checkbox and short-form text that can include relevant links to more verbose information on separate pages on your site. To configure this feature, place a `preSubmitInfo` object in the `formConfig`:

```js
preSubmitInfo: {
notice: '<p><strong>Note:</strong> According to federal law, there are criminal penalties, including a fine and/or imprisonment for up to 5 years, for withholding information or for providing incorrect information. (See 18 U.S.C. 1001)</p>',
required: true, // when false, the notice is shown without a checkbox
field: 'privacyAgreementAccepted', // name of the field in submitted data
label: 'I have read and accept the <a href="/privacy">privacy policy</a>.',
error: 'You must accept the privacy policy before continuing',
}
```

![Required checkbox before form submission](https://raw.githubusercontent.com/wiki/usds/us-forms-system/images/Required-Checkbox.jpg)

Expand Down
13 changes: 7 additions & 6 deletions lib/js/actions.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/js/actions.js.map

Large diffs are not rendered by default.

50 changes: 50 additions & 0 deletions lib/js/components/PreSubmitSection.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/js/components/PreSubmitSection.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

52 changes: 0 additions & 52 deletions lib/js/components/PrivacyAgreement.js

This file was deleted.

1 change: 0 additions & 1 deletion lib/js/components/PrivacyAgreement.js.map

This file was deleted.

63 changes: 32 additions & 31 deletions lib/js/review/SubmitController.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit db029cb

Please sign in to comment.