All notes

Form Errors Should Explain What to Change and Why

Separate field problems from service failures and make asynchronous validation recoverable.

English edition, edited for length. Read the complete Chinese original.

A failed submission should not clear valid input.

Assuming that after submitting the registration form, the only feedback provided is “information is incorrect,” and all input fields are cleared, the user is left without knowing which field is causing the problem and must re-enter valid data. The error feedback needs to identify the root cause, preserve the user’s work, and provide a clear path for correction, rather than simply indicating that the backend validation failed.

Consider a booking form with email, start date, and end date fields. Format, date ordering, and available inventory are three different checks. The client can help detect the first two; an authoritative service must confirm the third. The scenarios below are hypothetical, not observations of real users. For each failure, map what information remains, where focus goes, and what the next step is. Do not compress all three issues into one generic message at the top: “Please check your information.”

The Difference Between Field Errors and Service Errors

The goal of the appointment task is to obtain a confirmed time slot. The user input, structure validation, inventory confirmation, and final saving all have their own states. The inventory check confirms availability, but this does not guarantee that the item will be available when submitted. The server maintains the constraints during the final operation. The page indicates the current location and does not use a green checkmark to imply that the business has already reserved the time.

The scope of retaining input also needs to be defined. Common dates and instructions can be restored on the current page, while passwords and sensitive information are handled according to security policies. Cross-device storage requires explicit authorization and verification of the status. It is not advisable to store all values in the URL, logs, or long-term browser storage solely for the purpose of simplifying restoration. The convenience of restoration should be established within appropriate data boundaries.

Distinguish between field format errors, cross-field business constraints, and service anomalies. Errors in email format can be identified through field interpretation, while membership status issues involve existing members. Server failures are not caused by user input errors. The error model should include field relationships, stable types, and the actions users can perform.

The server can return stable code and field paths, such as the corresponding start and end dates for a date range conflict, instead of returning arbitrary text that the frontend has to guess. The component maps code to instructions, but still retains a safety net for unidentifiable errors. Sensitive information such as account existence should be handled separately and should not be revealed by disclosing which email addresses have already been registered, solely to make the message more specific.

Client-side validation provides early feedback but does not replace server-side checks. Error explanations must not disclose sensitive account-existence information. Passwords must not be written to URLs or logs just to preserve input. Success and failure messages must reflect the real outcome rather than pretend that a submission has been saved.

When should validation not interrupt input?

Connect error categories to recovery actions. A format error directs users to a field; a cross-field constraint identifies the affected group; an eligibility error offers a legitimate application path or alternative. For a service timeout, first establish the outcome. Do not mark ordinary inputs red for a service problem users cannot fix: that falsely suggests that they entered something incorrectly.

Server responses also have a protocol version. The client recognizes stable error codes and field paths; unknown codes receive a safe explanation and correlation ID, not a raw stack trace. Messages can be localized, but client logic must not depend on matching their wording. Coordinate business-rule updates with copy maintenance so old messages do not continue describing the wrong permitted range.

The specific level of sensitivity needs to be carefully considered. A request to restore an account does not directly reveal the existence of a particular email address, and insufficient permissions do not expose the titles of sensitive resources. Providing information that allows the next step to be taken does not mean revealing all internal reasons; the design must simultaneously meet both security boundaries and the task of restoring access.

Validation on blur reduces surprises after submission, but may interrupt someone whose input is not yet complete. Submission-time validation is quieter during entry but can cost more to recover from. Give format feedback at an appropriate moment and summarize complex business-rule failures after submission, rather than announce failure after every character.

For guidance during entry, such as password-length requirements, show the rules still to be satisfied instead of raising a red warning after every character. Evaluate a date range only when both dates are present. Business validation on submission avoids an API call for every keystroke, but needs a processing state and duplicate-submission protection. Choose timing according to whether the current input stage supports a reliable conclusion.

How Stale Validation Turns Correct Input Red Again

Initially, you can provide hints about the rules. After the user has filled in the fields or submitted, you can then determine if the input is valid. When the user has not yet entered a complete date, do not trigger “invalid” for each character. After submission, the user can modify the relevant fields, and old errors can be marked for re-validation, without immediately declaring that the new value is valid. The validation status includes “unverified,” “in progress,” “passed,” and “failed,” to avoid binary red and green masking the process.

Cross-field validation must follow dependencies. Changing the start date may invalidate an old end-date error and require another inventory check. Record dependency snapshots to determine which results remain applicable. Define those rules before choosing blur or submission timing; do not call the service indefinitely merely to make the form feel “real-time.”

Preventing duplicate submissions requires server-recognized operation identity; disabling a button is only an interaction safeguard. If a response is lost, users may refresh or retry in another tab. A stable business-intent identity and server-side idempotency mechanisms prevent duplicate bookings. Before re-enabling submission, establish whether the current outcome is known. A timeout does not necessarily mean nothing was saved.

The error only appears at the top of the page, making it difficult for users with narrow screens to find the field. After correcting the input, the error is not cleared, and the user may mistakenly believe that the field is still invalid. The error summary link corresponds to the control, and the field message describes the current problem. Asynchronous old responses cannot override the valid state of newly entered data.

Imagine a scenario where a user enters date A to trigger validation. Subsequently, they change it to date B, and the successful response for date B comes first, followed by the failure response for date A. If errors are updated in the order they are reached, the correct value will also be highlighted. Responses need to be associated with the request version or input snapshot; only results that still correspond to the current value are eligible for updating the field. Canceling old requests can save work, but it cannot replace result matching.

Combining Summaries, Fields, and Error Types

Asynchronous matching can be implemented using request sequence numbers and input snapshots, accepting only results that correspond to the current conditions. Even if a request is successfully cancelled, the matching process will still be executed because external or cached results may have already been returned. Ignoring old responses does not mean that the server is not working; resource budgets and cancellation can still be optimized.

Inventory results also have an expiry time and a business version. If users remain on the page for a long time before submitting, final confirmation is still required. The page can show when availability was checked and explain that no booking has yet taken effect. One successful check is not an indefinite guarantee. If the final operation conflicts, preserve input and offer the currently available ranges instead of requiring the entire form to be filled out again.

Service errors and field errors can coexist. When a user corrects a date, related errors are cleared, but new network errors are displayed separately. The error summary is not removed simply because one field has changed. Status handling is based on the type of error, to avoid the appearance of the interface being “fixed” while losing important diagnostic information.

Fields need visible labels and associated descriptions. Error messages explain the problem rather than blame the user. A failed submission preserves values that may safely be retained, and the top summary helps locate issues. Explain why controls are disabled during processing and handle repeated requests safely. Clear the relevant error after correction without swallowing a new service failure.

Error summaries are suitable for situations where multiple issues can occur in a single submission. Each item in the list links to a specific field or field group. Fields use aria-describedby to associate with explanatory text, and aria-invalid should be set if necessary, while retaining the normal label. Once the summary appears, focus can be moved to the summary to inform the user about the submission result. Avoid having multiple live regions repeatedly read the same group of messages, which would cause location information to be drowned out by repeated prompts.

Test Recovery with Deliberately Out-of-Order Responses

The summary appears after a clear submission failure, along with the current list of issues and links. The error message is placed near the input field and explains the constraints, and the visual cues are not limited to red; assistive technology can also understand the association. Focus management typically brings the submission result to a reasonable location, but does not allow each loss of focus to grab the focus. The user still controls the order of filling in the fields.

Cross-field errors can be associated with both the group title and the affected control, with a link pointing to the location that needs to be modified. Global service errors provide retry or status query functionality, without creating a link to a specific field. The summary at the top of the mobile interface has a clear separation from the fields below, and the fixed bar does not obscure the input after navigation.

Processing states must also be understandable. While saving, indicate that the action is not yet complete and offer cancellation only when it is safe. Keep button text and dimensions stable so loading does not shift the layout. On error, ordinary entered values remain; where necessary, explain why sensitive values must be re-entered so users do not interpret that requirement as the loss of all their work.

Handle empty values, excessively long values, invalid formats, and cross-field conflicts. Identify and pinpoint each error. Navigate to the summary using only the keyboard. Use the reader to hear the error associated with the input. Simulate timeout and expired responses to confirm that valid input remains. Users will not be required to repeat unnecessary work.

The form acceptance card includes a valid email address, an incorrectly formatted date, and a server-side business conflict. After the first submission, the valid content is retained, and the summary can jump to the date field. The reader is aware of the relationship between the field and the error. After correcting the date, the old response should not re-add the error; the service error should not indicate that the email is incorrect. Passwords should not be entered in the address, persistent logs, or error reports. Simulate a timeout and retry, and check if the user needs to re-enter the originally valid field. Acceptance requires verifying the error message, the association between the controls, and the actual reason for rejection in the backend, rather than just taking a screenshot of the red border.

Improve Forms Starting from the Error Data Contract

Error examples can serve as copy-regression fixtures. For the same error code, Chinese and English messages must preserve the cause, affected object, and recovery action. Translation must not turn “pending confirmation” into “not submitted.” Derive numbers, times, and ranges from actual rules instead of duplicating hard-to-maintain constants inside strings. Update corresponding examples when a rule changes.

For multi-step forms, when returning to a previous page, retain any previously confirmed regular input. Any changes that introduce dependencies should be marked for review. The system should not lose all subsequent information simply because one field has been modified, and it should not retain and pretend that previously invalid options are still valid. The page instructions should guide users to make the necessary corrections rather than repeating them unnecessarily.

Testers should focus on accurately identifying the root cause of the error and proposing the correct next steps, comparing them against the relevant fields and status. If the only response is “Please try again later” when the actual fix requires modifying the input, it indicates an incorrect error classification. Similarly, if the request is to change a field but the service fails, the contract needs to be adjusted. Accurate recovery actions are more important than polite phrasing.

Thoroughly compare the reasons for rejection in the backend, the error model, the summary, and the field descriptions. Unknown errors should not leak internal information, disordered results should not overwrite new values, and timeouts should not repeat business results. The keyboard and screen reader task records should maintain focus and announcements. Screenshots can only be used as evidence of appearance and cannot prove a complete recovery.

In addition to ensuring that the fixes successfully resolve the testing issues, it’s crucial to verify that refreshing, returning to the previous step, and timeout retries retain the appropriate content. Normal input should be preserved on the current page, while sensitive values should not be persistently stored unconditionally. Different fields should use different saving policies. After verifying the validation code, interface messages, and the actual reason for rejection, and then optimizing the icons and colors, we can ensure that the visual cues truly support the recovery process.

After launch, observe corrections, abandonment, and support requests by error category, not only total failures. Stricter validation may increase legitimate rejections; more specific messages may improve correction success. Record denominators and rule versions together. Repeated mistakes of the same kind may require a different input control or rule rather than larger red text.

Binding the validation result to an input snapshot

Suppose booking conditions comprise start date, end date, party size, and room type. Changing only party size may leave a date-format check valid while invalidating the inventory check. If the component records only “dates passed,” submission may reuse availability for one person to book four. List each check’s dependent fields and bind its result to the corresponding snapshot rather than give the entire form a permanently valid green state.

Maintain separate identities for input versions, check versions, and submission versions. Editing input expires the relevant checks; an asynchronous result updates only its own check; a submission uses a frozen intent snapshot. If users keep editing during submission, those new values belong to the next intent. Success for the old submission must not clear them. Whether editing is allowed during processing depends on the task, but the implementation must not merge two intents into one state.

Server-side standardization is another change. For example, it standardizes whitespace, formats dates, or converts acceptable representations, returning the results after conversion. The interface must clearly explain important differences and should not simply display the user’s original input and claim that it is the saved content. Standardization should not arbitrarily change the business meaning; if the conversion results in changes in range or amount, clear rules and confirmation are required.

Test identical values, equivalent representations, and genuinely different business values separately. Even after cancelling an old request, simulate its result arriving to check that snapshot matching works. Editing an unrelated description field must not invalidate every check; changing an inventory-dependent field must refresh the business check. Accurate dependencies protect correctness while reducing unnecessary requests and messages.

Multi-step forms should not treat completion as always valid

First, select the region. Second, select the service. Third, enter payment information. The user can return to modify the region, but the service may no longer be available, and taxes may also change. Products should clearly indicate which subsequent choices need to be reviewed. Retain valid information, do not clear all steps, and do not continue to display the status of each step as completed. The “completed” status indicates that it is valid under the current conditions, not a permanent pass.

A dependency table can state that region affects service coverage and tax, service affects available dates, dates affect inventory, and contact details affect none of those calculations. The interface can then say “Your contact information has been retained; please choose dates again,” which is more actionable than “Information is invalid.” Business rules define dependencies; the client must not infer from page order alone that every later value needs clearing.

Refreshing and restoring require distinguishing between drafts and submitted forms. When restoring a draft, re-verify eligibility and dynamically select options; display the reason for invalid entries. Do not treat browser-saved green “completed” marks as server-side confirmation. If the form contains sensitive data, the restoration strategy can only retain non-sensitive parts and explain the reason for re-entry. The convenient default should be to preserve secure work, rather than copying all values to long-term storage.

Continuing across devices requires a server-side draft and a clearly established identity. A URL may contain a nonsecret draft reference, but reading it still requires authorization. Possession of a shared link must not by itself grant access to payment or personal information. “Continue later” involves saved state, authorization, and retention, not merely another button.

After Service Timeout: First, Ask if the Result is Known

A booking request timeout may mean the request never arrived, is still executing, or succeeded but its response was lost. These outcomes must not all be labeled “Booking failed; please resubmit.” If the business provides a stable intent identity, the client can query the current result. When the result is unknown, explain that it is being checked and restrict retries that could create duplicate business operations. The server implements the specific idempotency mechanism; disabling a button prevents only some accidental actions.

When the same intent is submitted repeatedly, the system should either explain the existing result or the processing status. If the user genuinely changes the date, it represents a new intent and cannot be overwritten by the old, idempotent identity. The interface state and identity lifecycle must be consistent. Attaching a random identifier permanently to the form, or regenerating the identifier each time a click occurs, can disrupt the expected recovery process. You cannot simply assume that a request is safe just because a specific field is present.

A late success response also needs a context check. If the user has left the page and begun another booking, the old success message must not overwrite the new form. Update the result in the relevant history and provide an understandable notification if necessary, without clearing current input. Preserve the outcome as a fact while presenting it in a way that respects the user’s current task.

In a test, deliberately cut off the response, then use the status-query entry point to find the outcome and verify that only one booking exists. Change input to form a new intent and check that it does not incorrectly reuse the old result. Finally, deliver an old response late and check that the new input remains intact. This exercises a more realistic failure than repeatedly clicking Submit merely to observe whether the button is disabled.

Error copy must undergo actionability review

If an error is encountered by someone who didn’t participate in the implementation: What specific object is causing the problem, and what needs to be changed? Why is it currently necessary to wait? The term “invalid parameter” has no specific meaning. The message “Please check the date” may still be incomplete. The statement “The end date must be later than the start date” indicates a possible correction. To what extent should the security policy be followed, without revealing sensitive information in the process?

Review whether messages wrongly blame the user. Service unavailability is not incorrect input; an organizational restriction is not careless form filling; an unknown outcome is not a confirmed failure. Polite wording cannot compensate for incorrect causality. A stable error model must distinguish the real cause before copy can accurately support recovery.

Assigning Errors to Dynamic Fields Based on Identity, Not Array Position

The booking form allows for multiple companions to be added. When the second email address is incorrect, and the user deletes the first one, the error should not be associated with the new second entry. The field path should be able to associate with a stable sub-object’s identity, and convert to the current control during rendering. Sorting and deleting should change the position, but not affect the original object associated with the error.

If the affected object has been deleted, clear its errors without clearing other field problems. In a test, receive a business error first, then reorder rows and check that the summary link, message, and actual value still agree. Accurate dynamic-form recovery preserves not only input but also the relationship between each cause and its affected object.

References