-
Notifications
You must be signed in to change notification settings - Fork 336
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #583 from alphagov/add-error-summary-examples
Add error summary examples, add margin to error summary
- Loading branch information
Showing
4 changed files
with
152 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
{% from "back-link/macro.njk" import govukBackLink %} | ||
{% from "button/macro.njk" import govukButton %} | ||
{% from "date-input/macro.njk" import govukDateInput %} | ||
{% from "error-summary/macro.njk" import govukErrorSummary %} | ||
{% from "input/macro.njk" import govukInput %} | ||
|
||
{% extends "layout.njk" %} | ||
|
||
{% block content %} | ||
|
||
{{ govukBackLink({ | ||
"href": "/", | ||
"text": "Back" | ||
}) }} | ||
|
||
<main class="govuk-o-main-wrapper"> | ||
|
||
<form action="/" method="post"> | ||
|
||
{{ govukErrorSummary({ | ||
"titleText": "Message to alert the user to a problem goes here", | ||
"descriptionText": "Optional description of the errors and how to correct them", | ||
"classes": "optional-extra-class", | ||
"errorList": [ | ||
{ | ||
"text": "Descriptive link to the question with an error", | ||
"href": "#example-error-1" | ||
}, | ||
{ | ||
"text": "Descriptive link to the question with an error", | ||
"href": "#example-error-1" | ||
} | ||
] | ||
}) }} | ||
|
||
<h1 class="govuk-heading-xl">Passport details</h1> | ||
|
||
{{ govukInput({ | ||
label: { | ||
"html": '<h3 class="govuk-heading-m govuk-!-mb-r1">Passport number</h3>', | ||
"hintText": "For example, 502135326" | ||
}, | ||
id: "passport-number", | ||
name: "passport-number", | ||
errorMessage: { | ||
"text": "You must provide your passport number" | ||
} | ||
}) }} | ||
|
||
{{ govukDateInput({ | ||
fieldset: { | ||
legendHtml: '<h3 class="govuk-heading-m">Expiry date</h3>', | ||
legendHintText: 'For example, 08 2014' | ||
}, | ||
id: 'expiry', | ||
name: 'expiry', | ||
items:[ | ||
{ | ||
name: 'month' | ||
}, | ||
{ | ||
name: 'year' | ||
} | ||
], | ||
errorMessage: { | ||
"text": "You must provide your expiry date" | ||
} | ||
}) | ||
}} | ||
|
||
{{ govukButton({ | ||
"text": "Continue" | ||
}) }} | ||
|
||
</form> | ||
|
||
</main> | ||
|
||
{% endblock %} |
67 changes: 67 additions & 0 deletions
67
app/views/examples/error-summary-with-one-thing-per-page/index.njk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
{% from "back-link/macro.njk" import govukBackLink %} | ||
{% from "button/macro.njk" import govukButton %} | ||
{% from "date-input/macro.njk" import govukDateInput %} | ||
{% from "error-summary/macro.njk" import govukErrorSummary %} | ||
|
||
{% extends "layout.njk" %} | ||
|
||
{% block content %} | ||
|
||
{{ govukBackLink({ | ||
"href": "/", | ||
"text": "Back" | ||
}) }} | ||
|
||
<main class="govuk-o-main-wrapper"> | ||
|
||
<form action="/" method="post"> | ||
|
||
{{ govukErrorSummary({ | ||
"titleText": "Message to alert the user to a problem goes here", | ||
"descriptionText": "Optional description of the errors and how to correct them", | ||
"classes": "optional-extra-class", | ||
"errorList": [ | ||
{ | ||
"text": "Descriptive link to the question with an error", | ||
"href": "#example-error-1" | ||
}, | ||
{ | ||
"text": "Descriptive link to the question with an error", | ||
"href": "#example-error-1" | ||
} | ||
] | ||
}) }} | ||
|
||
{{ govukDateInput({ | ||
fieldset: { | ||
legendHtml: '<h1 class="govuk-heading-xl">What is your date of birth?</h1>', | ||
legendHintText: 'For example, 31 3 1980' | ||
}, | ||
id: 'dob', | ||
name: 'dob', | ||
items:[ | ||
{ | ||
name: 'day' | ||
}, | ||
{ | ||
name: 'month' | ||
}, | ||
{ | ||
name: 'year' | ||
} | ||
], | ||
errorMessage: { | ||
text: "You must provide your date of birth" | ||
} | ||
}) | ||
}} | ||
|
||
{{ govukButton({ | ||
"text": "Continue" | ||
}) }} | ||
|
||
</form> | ||
|
||
</main> | ||
|
||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters