What should a web form do when something goes wrong?
Imagine someone spending five minutes writing a customer enquiry. They press Send and get a red banner that says, “Something went wrong.” The banner gives them no clue whether an address was mistyped, the service stopped responding, or their message reached the company. Rewriting the enquiry and sending it again may waste time or produce a duplicate.
A useful form handles those situations separately. It tells the person what happened, keeps the information they can safely reuse, and gives them a next step they can actually take.
When the person can fix a field
If a booking date is missing, write “Choose a booking date” next to the field. If the form only accepts future dates, explain that rule before submission and repeat it next to the field when it applies. Start with the field’s visible label so people can recognize what the message refers to.
For a short form, the field message may be enough; test that keyboard and screen-reader users can find and hear it. For longer forms or several errors, a short summary above the form can link to each field that needs attention. Keep the specific message next to the field as well. A developer can associate the message with its control through aria-describedby. Make the message readable without relying on colour or an icon. W3C guidance on form notifications
After Send, make new errors and confirmations easy to discover. If the result appears without moving focus, use an appropriate live region so assistive technology can announce it. If you move focus to a linked error summary or the first invalid field, check that the next step is clear and that people can reach the relevant field using the keyboard. W3C guidance on status messages
When the service has a problem
A browser can catch common input errors early. The server still has to validate what it receives, including requests sent outside the normal form. When the server can identify a correctable field problem, return it in the same useful form the visitor sees for a browser-side error. W3C guidance on validating form input
When the service confirms it could not save the enquiry, say that plainly and keep ordinary inputs available for another attempt. Decide which values the application should retain, where it retains them, and when those values should be cleared. A short customer message and a password need different handling. Avoid a recovery design that saves sensitive entries on a shared device.
A timeout needs different wording because the service may have accepted the request before the response was lost. Use “We couldn’t confirm whether your enquiry was received” until the application confirms the result. If repeat submissions could create two bookings or orders, the service should recognize a repeat of the same attempt. If the same attempt cannot be retried safely, give the visitor a way to check whether the first submission was recorded before they try again.
Test what happens after Send
Use dummy details in a test environment and run these five cases with a keyboard and at a narrow screen width. Include a screen-reader check for the error and confirmation messages.
| What you test | What the visitor should be able to do |
|---|---|
| Leave a required field blank | Find the field, understand what it needs, and fix it without losing the other entries. |
| Trigger a server-side field error | See which field needs attention and continue where they left off. |
| Confirm that the service failed to save the enquiry | Read a clear message, keep safe entries, and take the next step. |
| Lose the response after the service saves the enquiry | Verify that the status check finds the existing enquiry. If the form offers a retry, repeat the same attempt and check that it creates no second record. |
| Complete a successful submission | Recognize that the service accepted it and know what happens next. If you promise a receipt, verify that it arrives. |
While testing, write down the exact message, where focus lands, whether the entries are still there, and what the receiving system actually recorded. That final check catches an error a polished screen can hide: the page says “received” even though the system has no record of the enquiry.