forked from alphagov/govuk_elements
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added examples for simple single question form pages, with and withou…
…t errors. See alphagov#543.
- Loading branch information
1 parent
dea6e7b
commit 89d09a0
Showing
6 changed files
with
187 additions
and
1 deletion.
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
22 changes: 22 additions & 0 deletions
22
app/views/examples/example_form_validation_single_question_radio_h1_legend.html
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,22 @@ | ||
{% extends "layout_example.html" %} | ||
|
||
{% block page_title %}{% if error %}Error: {% endif %}Example: Form validation — Errors — GOV.UK elements{% endblock %} | ||
|
||
{% block content %} | ||
<main class="js-error-example" id="content" role="main" tabindex="-1"> | ||
|
||
{% include "includes/breadcrumb.html" %} | ||
|
||
<div class="grid-row"> | ||
<div class="column-two-thirds"> | ||
|
||
<form method="post" action="/errors/example-form-validation-single-question-radio-h1-legend"> | ||
{% include "snippets/form_error_radio_h1_legend.html" %} | ||
</form> | ||
|
||
{% include "examples/_form_validation_implementation_advice.html" %} | ||
|
||
</div> | ||
</div> | ||
</main> | ||
{% endblock %} |
22 changes: 22 additions & 0 deletions
22
app/views/examples/example_form_validation_single_question_text_h1_label.html
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,22 @@ | ||
{% extends "layout_example.html" %} | ||
|
||
{% block page_title %}{% if error %}Error: {% endif %}Example: Form validation — Errors — GOV.UK elements{% endblock %} | ||
|
||
{% block content %} | ||
<main class="js-error-example" id="content" role="main" tabindex="-1"> | ||
|
||
{% include "includes/breadcrumb.html" %} | ||
|
||
<div class="grid-row"> | ||
<div class="column-two-thirds"> | ||
|
||
<form method="post" action="/errors/example-form-validation-single-question-text-h1-label"> | ||
{% include "snippets/form_error_text_h1_label.html" %} | ||
</form> | ||
|
||
{% include "examples/_form_validation_implementation_advice.html" %} | ||
|
||
</div> | ||
</div> | ||
</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
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,50 @@ | ||
{% if error %} | ||
<div class="error-summary" role="alert" aria-labelledby="error-summary-heading" tabindex="-1"> | ||
|
||
<h2 class="heading-medium error-summary-heading" id="error-summary-heading"> | ||
Message to alert the user to a problem goes here | ||
</h2> | ||
|
||
<p> | ||
Optional description of the errors and how to correct them | ||
</p> | ||
|
||
<ul class="error-summary-list"> | ||
<li><a href="#example-personal-details">Descriptive link to the question with an error</a></li> | ||
</ul> | ||
|
||
</div> | ||
{% endif %} | ||
|
||
<div class="form-group {% if error %} form-group-error{% endif %}"> | ||
<fieldset> | ||
|
||
<legend {% if error %} id="example-personal-details"{% endif %}> | ||
<h1 class="heading-large"> | ||
Are your personal details correct and up-to-date? | ||
</h1> | ||
|
||
<span class="form-hint">Look at your name, signature and other details.</span> | ||
|
||
{% if error %} | ||
<span class="error-message"> | ||
Error message about personal details goes here | ||
</span> | ||
{% endif %} | ||
|
||
</legend> | ||
|
||
<div class="multiple-choice"> | ||
<input id="personal_details_yes" type="radio" name="personalDetails" value="Yes"> | ||
<label for="personal_details_yes">Yes, my personal details are correct</label> | ||
</div> | ||
|
||
<div class="multiple-choice"> | ||
<input id="personal_details_no" type="radio" name="personalDetails" value="No"> | ||
<label for="personal_details_no">No, some details are wrong or have changed</label> | ||
</div> | ||
|
||
</fieldset> | ||
</div> | ||
|
||
<input class="button" type="submit" value="Continue"> |
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,38 @@ | ||
{% if error %} | ||
<div class="error-summary" role="alert" aria-labelledby="error-summary-heading" tabindex="-1"> | ||
|
||
<h2 class="heading-medium error-summary-heading" id="error-summary-heading"> | ||
Message to alert the user to a problem goes here | ||
</h2> | ||
|
||
<p> | ||
Optional description of the errors and how to correct them | ||
</p> | ||
|
||
<ul class="error-summary-list"> | ||
<li><a href="#example-name">Descriptive link to the question with an error</a></li> | ||
</ul> | ||
|
||
</div> | ||
{% endif %} | ||
|
||
|
||
<div class="form-group {% if error %} form-group-error{% endif %}"> | ||
<h1> | ||
<label for=""{% if error %} id="example-name"{% endif %}> | ||
<span class="heading-large" style="display:block;">What is your name?</span> | ||
|
||
<span class="form-hint">You can enter your full name</span> | ||
|
||
{% if error %} | ||
<span class="error-message"> | ||
Error message about name goes here | ||
</span> | ||
{% endif %} | ||
</label> | ||
</h1> | ||
|
||
<input type="text" class="form-control{% if error %} form-control-error{% endif %}" id="name" name="name" value=""> | ||
</div> | ||
|
||
<input class="button" type="submit" value="Continue"> |