Address lookup
When to use
Use an address lookup when you’re asking users for an address within the Bristol City Council (BCC) area. It asks users to enter the postcode and choose from a list of street addresses.
When not to use
As this address lookup only works for Bristol City Council area addresses, use a manual option such as text inputs or a textarea when you're collecting other UK or international addresses.
Step one
This is the default state.
Find your postcode on royalmail.com
<section class="address-lookup-block">
<div class="field field--postcode">
<div class="bcc-form-question">
<label for="postcode" class="field__label field__label--block"
>Postcode</label
>
</div>
<div class="bcc-form-answer">
<input
aria-describedby="postcode-error"
id="postcode"
name="postcode"
class="field__input"
type="text"
value=""
/>
<button type="submit" class="button secondary">Find address</button>
</div>
<h6 class="field__message">
Find your postcode on
<a href="https://www.royalmail.com/find-a-postcode">royalmail.com</a>
</h6>
</div>
</section>
You should allow users to enter their postcode:
- in upper or lower case
- without spaces or with additional spaces at the beginning, middle or end
This is better for the user than rejecting the input and telling them they have entered an invalid postcode.
Step two
A postcode has been entered. Now the user can select an address.
Find your postcode on royalmail.com
<section class="address-lookup-block">
<div class="field field--postcode">
<div class="bcc-form-question">
<label for="postcode" class="field__label field__label--block"
>Postcode</label
>
</div>
<div class="bcc-form-answer">
<input
aria-describedby="postcode-error"
id="postcode"
name="postcode"
class="field__input"
type="text"
value="BS1 1SA"
/><button type="submit" class="button secondary">Find address</button>
</div>
<h6 class="field__message">
Find your postcode on
<a href="https://www.royalmail.com/find-a-postcode">royalmail.com</a>
</h6>
</div>
<div class="field">
<div class="bcc-form-question">
<label for="address" class="field field__label field__label--block"
>Your address</label
>
</div>
<div class="drop drop--block">
<select aria-describedby="address-error" id="address" name="address">
<option>Select address</option>
<option>2 Baldwin Street Bristol BS1 1SA</option>
<option>3 Baldwin Street Bristol BS1 1SA</option>
<option>4 Baldwin Street Bristol BS1 1SA</option>
<option>6 Baldwin Street Bristol BS1 1SA</option>
<option>8-10 Baldwin Street Bristol BS1 1SA</option>
</select>
<div class="drop__background"></div>
</div>
<h6 class="field__message">
<a href="https://bristol.gov.uk/address-not-listed"
>Tell us your address isn't listed</a
>
</h6>
</div>
</section>
Step three
An address has been selected and a panel is displayed.
Find your postcode on royalmail.com
Your selected address
2 Baldwin Street Bristol BS1 1SA
<div class="field field--postcode">
<div class="bcc-form-question">
<label for="postcode" class="field__label field__label--block"
>Postcode</label
>
</div>
<div class="bcc-form-answer">
<input
aria-describedby="postcode-error"
id="postcode"
name="postcode"
class="field__input"
type="text"
value="BS1 1SA"
/><button type="submit" class="button secondary">Find address</button>
</div>
<h6 class="field__message">
Find your postcode on
<a href="https://www.royalmail.com/find-a-postcode">royalmail.com</a>
</h6>
</div>
<div class="field">
<div class="bcc-form-question">
<label for="address" class="field field__label field__label--block"
>Your address</label
>
</div>
<div class="drop drop--block">
<select aria-describedby="address-error" id="address" name="address">
<option disabled="">Select address</option>
<option>2 Baldwin Street Bristol BS1 1SA</option>
<option>3 Baldwin Street Bristol BS1 1SA</option>
<option>4 Baldwin Street Bristol BS1 1SA</option>
<option>6 Baldwin Street Bristol BS1 1SA</option>
<option>8-10 Baldwin Street Bristol BS1 1SA</option>
</select>
<div class="drop__background"></div>
</div>
<h6 class="field__message">
<a href="https://bristol.gov.uk/address-not-listed"
>Tell us your address isn't listed</a
>
</h6>
</div>
<div class="info info--affirm info--reverse">
<h4>Your selected address</h4>
<h2>2 Baldwin Street Bristol BS1 1SA</h2>
</div>
This step includes a link for users to tell BCC that an address is not listed.
Error messages
Display an error when there's a problem.
Make sure:
- The form control has the
aria-describedby
attribute and references an associated error message - The associated error message has a unique ID
Standard error messages
There are 3 standard error messages which should be used on all address lookups:
Service not available
If the postcode service is not available:
Find your postcode on royalmail.com
<div class="field field--postcode field--error">
<div class="bcc-form-question">
<label for="postcode" class="field__label field__label--block"
>Postcode</label
>
</div>
<div class="bcc-form-answer">
<input
aria-describedby="postcode-error"
id="postcode"
name="postcode"
class="field__input"
type="text"
value=""
/><button type="submit" class="button secondary">Find address</button>
</div>
<h6 class="field__message">
Find your postcode on
<a href="https://www.royalmail.com/find-a-postcode">royalmail.com</a>
</h6>
<div id="postcode-error" class="field__message field__message--error">
Service not available. Please try again later.<br />
</div>
</div>
User enters an invalid postcode
If a user enters an invalid postcode. For example, 20B 2PH:
Find your postcode on royalmail.com
<div class="field field--postcode field--error">
<div class="bcc-form-question">
<label for="postcode" class="field__label field__label--block"
>Postcode</label
>
</div>
<div class="bcc-form-answer">
<input
aria-describedby="postcode-error"
id="postcode"
name="postcode"
class="field__input"
type="text"
value=""
/><button type="submit" class="button secondary">Find address</button>
</div>
<h6 class="field__message">
Find your postcode on
<a href="https://www.royalmail.com/find-a-postcode">royalmail.com</a>
</h6>
<div id="postcode-error" class="field__message field__message--error">
This must be a valid postcode. Check you've entered it correctly.<br />
</div>
</div>
User enters a postcode outside the BCC area
If a user enters a postcode that's outside the BCC area:
Find your postcode on royalmail.com
<div class="field field--postcode field--error">
<div class="bcc-form-question">
<label for="postcode" class="field__label field__label--block"
>Postcode</label
>
</div>
<div class="bcc-form-answer">
<input
aria-describedby="postcode-error"
id="postcode"
name="postcode"
class="field__input"
type="text"
value=""
/><button type="submit" class="button secondary">Find address</button>
</div>
<h6 class="field__message">
Find your postcode on
<a href="https://www.royalmail.com/find-a-postcode">royalmail.com</a>
</h6>
<div id="postcode-error" class="field__message field__message--error">
We couldn't find that postcode in the Bristol City Council area<br /><br /><a
href="https://www.gov.uk/find-local-council"
>Check which local authority you're in (GOV.UK)</a
><br /><a href="https://www.bristol.gov.uk/address-not-listed"
>Tell us your postcode isn't listed</a
>
</div>
</div>