Skip to main content

This is a draft (version 0.5.0). The National Information Technology Agency (NITA) plans to make GGDS official guidance for government websites after independent accessibility testing. What this means

Ghana Government Design System Design system for Government of Ghana websites – home Search

Pattern

Ask for a phone number

One phone box that accepts a Ghana number however people write it, says how you will use it, and asks for the network only for mobile money.

When to use

  • When you will call people or send them an SMS about their application, complaint or appointment.
  • When you will pay people, or take payment, by mobile money.

When not to use

  • When you will never call or text. Do not ask for a phone number "just in case". Only collect the personal data you need.

How it works

  1. The question, such as "What is your phone number?", or a "Phone number" label in a page of contact details.
  2. The hint says how you will use it, and shows an example: "We will send you an SMS when we have made a decision. For example, 024 000 0000."
  3. One phone box, medium width, that accepts the number however people write it.
  4. For mobile money only, a separate question for the network, with radios.

Ghana phone numbers

  • A Ghana number has 10 digits and starts with 0, such as 024 000 0000 for a mobile or 030 000 0000 for a landline in Accra.
  • From abroad, or in international form, it is +233 and the same number without the first 0: +233 24 000 0000.
  • Do not reject a number because of its first 3 digits. Networks get new prefixes, and people keep their number when they move to another network.

The phone box

  • Use type="tel" and autocomplete="tel", with the ggds-input--width-medium class. Phones then show the number keypad and can fill in the person's own number.
  • Use one box. Do not split the number into several boxes, and do not make people choose a network or a country code from a list before they type.
  • Do not use type="number". It removes the first 0 in some browsers and does not allow + or spaces.
  • Say in the hint how you will use the number: SMS updates, a call from an officer, or both. If you will only send SMS, say "mobile number".

Checking the answer

  • Accept spaces, hyphens, dots and brackets, and remove them before you check: "024-000-0000", "(024) 000 0000" and "024 000 0000" are the same answer.
  • Accept all three Ghana forms: 0240000000, 233240000000 and +233240000000. Store one form, such as +233240000000, so you can send SMS to it.
  • Show the number back in groups, the way people say it: 024 000 0000.
  • Keep what people typed when there is an error, so they can correct it.

Numbers outside Ghana

  • People living abroad may not have a Ghana number. If your service can call or text abroad, accept any number that starts with + and a country code, such as +44 or +1, and say so in the hint.
  • If you can only use Ghana numbers, say so in the hint, and give another way to contact people, such as email.

Mobile money

  • Ask for the network only when you need it to pay or take a payment by mobile money. Ask it as a separate question with radios: MTN, Telecel and AT.
  • Do not guess the network from the number. People move their number between networks.
  • Ask "What is your mobile money number?", not "phone number", because some people use a different number for mobile money.
  • Show the number and network on the check answers page, so people can spot a mistake before money is sent.

Error messages

Use these messages in the error summary and next to the field.

  • If it is empty: "Enter your phone number".
  • If it has letters or other symbols: "Phone number must only include numbers, spaces, brackets, hyphens and +".
  • If a Ghana number has too few or too many digits: "Enter a phone number with 10 digits, such as 024 000 0000".
  • If a number from outside Ghana is not accepted: "Enter a Ghana phone number, such as 024 000 0000".
  • If the network is not chosen: "Select the network for your mobile money number".

Accessibility

  • Follow the accessibility advice in the ask for information pattern: a unique page title, the question as the heading, and a Back link.
  • Do not put the example in placeholder text. Put it in the hint, where it stays while people type.
  • Connect the hint and any error message to the box with aria-describedby, hint first, and add aria-invalid="true" on error.
  • Offer another way to be contacted, such as email or a letter, for people who cannot use a phone.

Example: A question page

Open this example on its own page

HTML code for “A question page”
HTML
<p><a href="/apply/address/">Back</a></p>
<form action="/apply/email/" method="post" novalidate>
  <div class="ggds-field">
    <h1><label class="ggds-label ggds-label--page" for="phone-number">What is your phone number?</label></h1>
    <p class="ggds-hint" id="phone-number-hint">We will send you an SMS when we have made a decision. For example, 024 000 0000 or +233 24 000 0000.</p>
    <input class="ggds-input ggds-input--width-medium" id="phone-number" name="phone" type="tel" autocomplete="tel" inputmode="tel" aria-describedby="phone-number-hint">
  </div>
  <button class="ggds-button" type="submit">Continue</button>
</form>
JSX (React)
<>
  <p><a href="/apply/address/">Back</a></p>
  <form action="/apply/email/" method="post" noValidate>
    <div className="ggds-field">
      <h1><label className="ggds-label ggds-label--page" htmlFor="phone-number">What is your phone number?</label></h1>
      <p className="ggds-hint" id="phone-number-hint">We will send you an SMS when we have made a decision. For example, 024 000 0000 or +233 24 000 0000.</p>
      <input className="ggds-input ggds-input--width-medium" id="phone-number" name="phone" type="tel" autoComplete="tel" inputMode="tel" aria-describedby="phone-number-hint" />
    </div>
    <button className="ggds-button" type="submit">Continue</button>
  </form>
</>

Example: A question page after a failed submit

Open this example on its own page

HTML code for “A question page after a failed submit”
HTML
<p><a href="/apply/address/">Back</a></p>
<div class="ggds-error-summary" data-ggds-module="error-summary" role="alert" aria-labelledby="phone-error-title" tabindex="-1">
  <h2 class="ggds-error-summary__title" id="phone-error-title">There is a problem</h2>
  <ul class="ggds-error-summary__list">
    <li><a href="#phone-number-error-field">Enter a phone number with 10 digits, such as 024 000 0000</a></li>
  </ul>
</div>
<form action="/apply/email/" method="post" novalidate>
  <div class="ggds-field ggds-field--error">
    <h1><label class="ggds-label ggds-label--page" for="phone-number-error-field">What is your phone number?</label></h1>
    <p class="ggds-hint" id="phone-number-error-field-hint">We will send you an SMS when we have made a decision. For example, 024 000 0000 or +233 24 000 0000.</p>
    <p class="ggds-error-message" id="phone-number-error-field-error"><span class="ggds-visually-hidden">Error:</span> Enter a phone number with 10 digits, such as 024 000 0000</p>
    <input class="ggds-input ggds-input--width-medium" id="phone-number-error-field" name="phone" type="tel" autocomplete="tel" inputmode="tel" aria-invalid="true" aria-describedby="phone-number-error-field-hint phone-number-error-field-error" value="024 000 00">
  </div>
  <button class="ggds-button" type="submit">Continue</button>
</form>
JSX (React)
<>
  <p><a href="/apply/address/">Back</a></p>
  <div className="ggds-error-summary" data-ggds-module="error-summary" role="alert" aria-labelledby="phone-error-title" tabIndex={-1}>
    <h2 className="ggds-error-summary__title" id="phone-error-title">There is a problem</h2>
    <ul className="ggds-error-summary__list">
      <li><a href="#phone-number-error-field">Enter a phone number with 10 digits, such as 024 000 0000</a></li>
    </ul>
  </div>
  <form action="/apply/email/" method="post" noValidate>
    <div className="ggds-field ggds-field--error">
      <h1><label className="ggds-label ggds-label--page" htmlFor="phone-number-error-field">What is your phone number?</label></h1>
      <p className="ggds-hint" id="phone-number-error-field-hint">We will send you an SMS when we have made a decision. For example, 024 000 0000 or +233 24 000 0000.</p>
      <p className="ggds-error-message" id="phone-number-error-field-error"><span className="ggds-visually-hidden">Error:</span> Enter a phone number with 10 digits, such as 024 000 0000</p>
      <input className="ggds-input ggds-input--width-medium" id="phone-number-error-field" name="phone" type="tel" autoComplete="tel" inputMode="tel" aria-invalid="true" aria-describedby="phone-number-error-field-hint phone-number-error-field-error" defaultValue="024 000 00" />
    </div>
    <button className="ggds-button" type="submit">Continue</button>
  </form>
</>

Example: Asking for a mobile money number and network

Open this example on its own page

HTML code for “Asking for a mobile money number and network”
HTML
<p><a href="/refund/amount/">Back</a></p>
<h1>Where should we send your refund?</h1>
<p>We will send your refund by mobile money. Check the number carefully: we cannot get the money back if it goes to the wrong account.</p>
<form action="/refund/check/" method="post" novalidate>
  <div class="ggds-field">
    <label class="ggds-label" for="momo-number">What is your mobile money number?</label>
    <p class="ggds-hint" id="momo-number-hint">The number your mobile money account uses. For example, 024 000 0000.</p>
    <input class="ggds-input ggds-input--width-medium" id="momo-number" name="momoNumber" type="tel" autocomplete="tel" inputmode="tel" aria-describedby="momo-number-hint">
  </div>
  <div class="ggds-field">
    <fieldset class="ggds-fieldset" aria-describedby="momo-network-hint">
      <legend class="ggds-fieldset__legend">Which network is your mobile money account on?</legend>
      <p class="ggds-hint" id="momo-network-hint">If you moved your number from another network, choose the one you use now.</p>
      <div class="ggds-choices">
        <div class="ggds-choice"><input class="ggds-choice__input" id="momo-network-mtn" name="momoNetwork" type="radio" value="mtn"><label class="ggds-choice__label" for="momo-network-mtn">MTN</label></div>
        <div class="ggds-choice"><input class="ggds-choice__input" id="momo-network-telecel" name="momoNetwork" type="radio" value="telecel"><label class="ggds-choice__label" for="momo-network-telecel">Telecel</label></div>
        <div class="ggds-choice"><input class="ggds-choice__input" id="momo-network-at" name="momoNetwork" type="radio" value="at"><label class="ggds-choice__label" for="momo-network-at">AT</label></div>
      </div>
    </fieldset>
  </div>
  <button class="ggds-button" type="submit">Continue</button>
</form>
JSX (React)
<>
  <p><a href="/refund/amount/">Back</a></p>
  <h1>Where should we send your refund?</h1>
  <p>We will send your refund by mobile money. Check the number carefully: we cannot get the money back if it goes to the wrong account.</p>
  <form action="/refund/check/" method="post" noValidate>
    <div className="ggds-field">
      <label className="ggds-label" htmlFor="momo-number">What is your mobile money number?</label>
      <p className="ggds-hint" id="momo-number-hint">The number your mobile money account uses. For example, 024 000 0000.</p>
      <input className="ggds-input ggds-input--width-medium" id="momo-number" name="momoNumber" type="tel" autoComplete="tel" inputMode="tel" aria-describedby="momo-number-hint" />
    </div>
    <div className="ggds-field">
      <fieldset className="ggds-fieldset" aria-describedby="momo-network-hint">
        <legend className="ggds-fieldset__legend">Which network is your mobile money account on?</legend>
        <p className="ggds-hint" id="momo-network-hint">If you moved your number from another network, choose the one you use now.</p>
        <div className="ggds-choices">
          <div className="ggds-choice"><input className="ggds-choice__input" id="momo-network-mtn" name="momoNetwork" type="radio" value="mtn" /><label className="ggds-choice__label" htmlFor="momo-network-mtn">MTN</label></div>
          <div className="ggds-choice"><input className="ggds-choice__input" id="momo-network-telecel" name="momoNetwork" type="radio" value="telecel" /><label className="ggds-choice__label" htmlFor="momo-network-telecel">Telecel</label></div>
          <div className="ggds-choice"><input className="ggds-choice__input" id="momo-network-at" name="momoNetwork" type="radio" value="at" /><label className="ggds-choice__label" htmlFor="momo-network-at">AT</label></div>
        </div>
      </fieldset>
    </div>
    <button className="ggds-button" type="submit">Continue</button>
  </form>
</>

Components used

Back to top

Something wrong, unclear or missing? Report a problem with this page or suggest a change to it on GitHub. You need a GitHub account.