Skip to content

Commit

Permalink
Merge pull request #3337 from alphagov/handle-form-submissions
Browse files Browse the repository at this point in the history
Redirect form submissions somewhere sensible
  • Loading branch information
36degrees authored Nov 28, 2023
2 parents cc6ca73 + 777b8c0 commit 10877d9
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
24 changes: 24 additions & 0 deletions netlify.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
# A number of the examples in the Design System include <form> elements so that
# users copying the examples have something that requires relatively little
# tweaking to work out the box (in particular Prototype Kit users, for example)
#
# We have some JavaScript to prevent those forms actually being submitted but
# for users who don’t have JavaScript enabled (or who manage to interact with
# the form before the JS has run) it’s still possible to submit the form.
#
# Handle that gracefully by redirecting to a page that explains what has
# happened and what the user needs to do next.
#
# POST requests work just fine. Requires examples to be set up with an action of
# `/form-handler`.

[[redirects]]
from = "/form-handler"
to = "/form-success"
status = 301

# Proxy requests for security.txt to the centralised Cabinet Office
# vulnerability disclosure policy (VDP)
#
# https://github.com/alphagov/security.txt

[[redirects]]
from = "/.well-known/security.txt"
to = "https://vdp.cabinetoffice.gov.uk/.well-known/security.txt"
Expand Down
10 changes: 10 additions & 0 deletions src/form-success.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: Form submitted
layout: layout-example.njk
---

<h1 class="govuk-heading-m">Form submitted</h1>

<p class="govuk-body">You're seeing this page because you submitted a form in an example.</p>

<p class="govuk-body">You can return to the previous page by using your browser's back button.</p>

0 comments on commit 10877d9

Please sign in to comment.