[CFI] [$175] Expense creation - Show required-field validation error above the footer button
Problem
When a required expense field is outside the visible scroll area, clicking Save Expense can appear to do nothing. The field-level validation error is not visible near the footer, leaving the user without an obvious explanation of why saving is blocked.
The original report, Unable to create a new Expense from Reports > More > Create Expense, was closed after the thread clarified that the amount was missing from a manually completed expense. This issue tracks the separate validation-feedback UX improvement, not a failure to save a valid expense.
Example flow
- Go to Spend > Reports and open a report containing an expense.
- Choose More > Add Expense > Create Expense.
- Select Scan and upload a receipt.
- Select tags/category and expand Show more / More Details.
- Manually enter merchant and date, but leave amount empty.
- Scroll so the amount field is out of view, then click Save Expense.
Reported behavior: Saving is blocked by the missing amount, but its inline error is outside the viewport, making the button appear unresponsive.
Reported environment: Windows, Firefox; version 9.5.27-2. This follow-up has not been independently reproduced, and the improvement should not be assumed to be Firefox-specific.
Requested improvement
Display a visible validation summary immediately above the footer button when required fields prevent expense creation, including when the affected fields are out of view.
Suggested copy from the discussion: “Please enter the required fields.” with the standard error indicator.
- Preserve the specific inline errors on the affected fields.
- Keep invalid submissions blocked; do not bypass validation.
- Clear the summary when the required-field errors are corrected.
- Showing more coding options alone should not be treated as opting out of SmartScan; the example involves manually entering expense fields.
Acceptance criteria
- Submitting with a missing required field outside the viewport shows an explanation above the footer button.
- The error is also understandable when the affected field is visible.
- Correcting all required fields clears the error and allows normal expense creation.
Slack thread: https://expensify.slack.com/archives/C049HHMV9SM/p1793658573409119
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~022118773025354391284
- Upwork Job ID: 2118773025354391284
- Last Price Increase: 2026-11-06
- Automatic offers:
- TaduJR | Reviewer | 113037456
Issue Owner
Current Issue Owner: @rlinoz
Triggered auto assignment to Contributor-plus team member for initial proposal review - @TaduJR (External)
Job added to Upwork: https://www.upwork.com/jobs/~022118773025354391284
Proposal
What is the root cause of that problem?
In src/components/MoneyRequestConfirmationList/hooks/useFormErrorManagement.ts:
const isSuppressedInline = (error: TranslationPaths | ''): boolean =>
error === 'common.error.fieldRequired' || error === 'iou.error.invalidMerchant' || (!isDistanceRequest && error === 'common.error.invalidAmount');
const computeErrorMessage = (): string | undefined => {
if (routeError) {
return routeError;
}
if (isSuppressedInline(formError)) {
return undefined;
}
...
- When validation fails due to missing required fields,
useConfirmationValidationsetsformError = 'common.error.fieldRequired'. - However,
isSuppressedInlineintentionally suppressescommon.error.fieldRequiredfromcomputeErrorMessage()so that specific inline error messages on individual inputs are not duplicated verbatim in the footer. - As a result,
errorMessageevaluates toundefined, andConfirmationFooterContent.tsx:205–214renders nothing in its footerFormHelpMessageabove the button. - When the invalid field is scrolled off-screen, the user receives zero feedback when clicking "Save Expense".
- Furthermore, the automatic-clearing hook in
useFormErrorManagement.ts:224–236checksisAmountRequiredMissing,isDateRequiredMissing, andisMerchantRequiredMissing, but must ensure required manual merchants are strictly evaluated so correcting Amount does not prematurely clear the summary while Merchant remains blank.
What changes do you think we should make in order to solve the problem?
-
Add new localized summary copy: In
src/languages/en.ts:iou: { error: { enterRequiredFields: 'Please enter the required fields.', }, }In
src/languages/es.ts:iou: { error: { enterRequiredFields: 'Por favor, completa los campos requeridos.', }, } -
Return the summary error for required-field failures in
useFormErrorManagement.ts: Insrc/components/MoneyRequestConfirmationList/hooks/useFormErrorManagement.ts: Distinguish between missing required fields and invalid non-empty inputs (such as overlength merchants or invalid custom amounts).- Keep internal validation keys and specific inline errors on fields unchanged.
- For
formError === 'common.error.fieldRequired', return the summary translationtranslate('iou.error.enterRequiredFields')in the existing footer error message:
const computeErrorMessage = (): string | undefined => { if (routeError) { return routeError; } if (formError === 'common.error.fieldRequired') { return translate('iou.error.enterRequiredFields'); } if (isSuppressedInline(formError)) { return undefined; } return formError ? translate(formError) : undefined; }; -
Split Expenses handling: Ensure the live required-field summary error is shown immediately for split expense validation without unnecessary debounce delay, while preserving debounce handling for other dynamic validation errors and retaining route-error priority and submission blocking.
-
Auto-clearing hook alignment: In
useFormErrorManagement.ts:224–236, ensure manual required merchants (isMerchantRequiredMissing) and unset amounts are strictly evaluated so the footer validation summary automatically clears when all required fields are filled, and does not dismiss prematurely while any required field remains empty. -
Regression coverage:
- Both off-screen and visible missing required fields.
- Summary clearing immediately after user fills the last missing required field.
- Multiple missing fields (Amount + Date + Merchant).
- Split expenses validation flow.
- Untouched Scans remaining eligible for SmartScan.
What alternative solutions did you explore? (Optional)
- Auto-scroll only: Does not provide the requested persistent explanation above the button if the user scrolls back down.
- Show summary for every suppressed error: Incorrectly describes invalid values (e.g. overlength merchant names) as missing fields.
- Add a separate footer banner component: Unnecessary because
ConfirmationFooterContent.tsxalready renders the existingFormHelpMessageabove the footer button.
Contributor details
Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~0131dae36abcf59374
Proposal
Please re-state the problem that we are trying to solve in this issue.
When creating/editing an expense with a missing required field scrolled off-screen, clicking "Save Expense" appears unresponsive because inline errors are out of view and no message renders above the footer button.
What is the root cause of that problem?
In useFormErrorManagement.ts:
isSuppressedInline suppresses common.error.fieldRequired, iou.error.invalidMerchant, and common.error.invalidAmount from computeErrorMessage(). When required field validation fails in useConfirmationValidation, computeErrorMessage() returns undefined, leaving ConfirmationFooterContent.tsx with no error message above the button.
Crucially, competing proposals only handle fieldRequired and miss invalidMerchant when an empty merchant is required under policy rules (useConfirmationValidation.ts line 231), leaving the button unresponsive.
What changes do you think we should make in order to solve the problem?
-
Localization key: In
src/languages/en.tsandsrc/languages/es.ts, addiou.error.enterRequiredFields("Please enter the required fields."). -
Surface footer summary in
useFormErrorManagement.ts: IncomputeErrorMessage(), returntranslate('iou.error.enterRequiredFields')whenformError === 'common.error.fieldRequired'orformError === 'iou.error.invalidMerchant' && isMerchantRequiredMissing. Preserves inline errors while rendering the general summary above the footer button. -
Auto-clearing & Split requests: The existing
useEffectinuseFormErrorManagement.tsobserving missing fields already clearsformErroronce filled. Apply the same check to split bill debounced errors.
Compare branch: https://github.com/Expensify/App/compare/main...camesenin:App:fix-issue-106237?expand=1
What automated tests can you add to prevent this from re-occurring?
In tests/unit/useFormErrorManagementTest.ts:
- Verify
errorMessagereturnsenterRequiredFieldswhenformErrorisfieldRequiredor missing required merchant. - Verify
errorMessageclears when all required fields are provided.
Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~01b60d704ba377be83
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
Proposal
Please re-state the problem that we are trying to solve in this issue.
When creating or confirming an expense (for example via Spend > Reports > More > Add Expense > Create Expense), if a required field (Amount, Date, or Merchant) is missing and scrolled outside the visible viewport, clicking the footer submit button (Save Expense / Create Expense) appears completely unresponsive because the inline field error is off-screen and the footer summary error is suppressed.
What is the root cause of that problem?
There are two interconnected root causes across src/components/MoneyRequestConfirmationList/hooks/useFormErrorManagement.ts and src/components/MoneyRequestConfirmationList/hooks/useConfirmationValidation.ts:
-
useFormErrorManagement.tsunconditionally suppressescommon.error.fieldRequiredfrom the footererrorMessage: Insrc/components/MoneyRequestConfirmationList/hooks/useFormErrorManagement.ts:268-295:const isSuppressedInline = (error: TranslationPaths | ''): boolean => error === 'common.error.fieldRequired' || error === 'iou.error.invalidMerchant' || (!isDistanceRequest && error === 'common.error.invalidAmount'); const computeErrorMessage = (): string | undefined => { if (routeError) { return routeError; } if (isSuppressedInline(formError)) { return undefined; } if (isTypeSplit && !shouldShowReadOnlySplits) { return debouncedFormError && !isSuppressedInline(debouncedFormError) ? translate(debouncedFormError) : undefined; }When
useConfirmationValidationblocks submission with{errorKey: 'common.error.fieldRequired'}(for a missing manual amount, a partially filled manual Scan expense, or a cleared date),isSuppressedInlinecausescomputeErrorMessage()to returnundefined. Consequently,ConfirmationFooterContentrenders noFormHelpMessageabove the footer button. -
In manual / workspace flows where Amount and Date are valid but a required Merchant is left blank,
useConfirmationValidationreturnsiou.error.invalidMerchantinstead ofcommon.error.fieldRequired: Insrc/components/MoneyRequestConfirmationList/hooks/useConfirmationValidation.ts:183-190:if (isMerchantRequired) { if (!isEditingSplitBill && !isMerchantFieldValid) { return {errorKey: 'iou.error.invalidMerchant'}; } if (isEditingSplitBill && (isMerchantEmpty || (shouldDisplayFieldError && isMerchantMissing(transaction)))) { return {errorKey: 'iou.error.invalidMerchant'}; } }Meanwhile,
MerchantField.tsx:87-92explicitly expectsformError === 'common.error.fieldRequired'whenisMerchantRequired && !displayMerchantValue:if ( formError === 'common.error.fieldRequired' && (isConfirmationMerchantMissing(merchantState, canEnterScanFieldsManually, isPolicyExpenseChat) || (isMerchantRequired && !displayMerchantValue)) ) { return translate('common.error.fieldRequired'); }Because
useConfirmationValidationreturns'iou.error.invalidMerchant'even when the merchant field is simply empty/untyped (isMerchantEmptyorisUntypedPlaceholderMerchant(transaction?.isMerchantSet, iouMerchant?.trim() ?? '')), a missing required merchant on a manual workspace expense would NOT triggercommon.error.fieldRequired(nor show the footer required-fields summary) unless empty required merchants are distinguished from typed invalid merchants!
What changes do you think we should make in order to solve the problem?
-
Add the translation key
common.error.pleaseEnterRequiredFieldsinsrc/languages/en.ts(and corresponding locale fileses.ts,fr.ts,de.ts, etc.):// src/languages/en.ts under common.error: pleaseEnterRequiredFields: 'Please enter the required fields.', -
Return
common.error.fieldRequiredwhen a required merchant is empty/untyped insrc/components/MoneyRequestConfirmationList/hooks/useConfirmationValidation.ts: WhenisMerchantRequiredis true and the merchant is empty or still holds the untyped default placeholder (isMerchantEmpty || isUntypedPlaceholderMerchant(transaction?.isMerchantSet, merchantValue.trim())), return{errorKey: 'common.error.fieldRequired'}(so both the inlineMerchantFieldrequired error at lines 88–91 and the footer summary error are triggered consistently), while keeping{errorKey: 'iou.error.invalidMerchant'}for non-empty invalid merchant strings:const isMerchantBlank = isMerchantEmpty || isUntypedPlaceholderMerchant(transaction?.isMerchantSet, merchantValue.trim()); if (isMerchantRequired) { if (!isEditingSplitBill && !isMerchantFieldValid) { return {errorKey: isMerchantBlank ? 'common.error.fieldRequired' : 'iou.error.invalidMerchant'}; } if (isEditingSplitBill && (isMerchantEmpty || (shouldDisplayFieldError && isMerchantMissing(transaction)))) { return {errorKey: 'common.error.fieldRequired'}; } }And in
useFormErrorManagement.ts:228, include(isMerchantRequired && isMerchantBlank)inisMerchantRequiredMissingso the existing auto-clearuseEffectat lines 229–236 clearsformErroras soon as the merchant is entered. -
Map
common.error.fieldRequiredtotranslate('common.error.pleaseEnterRequiredFields')insrc/components/MoneyRequestConfirmationList/hooks/useFormErrorManagement.ts: UpdateisSuppressedInlineandcomputeErrorMessageso that'common.error.fieldRequired'is no longer suppressed toundefined, and instead renderstranslate('common.error.pleaseEnterRequiredFields')above the footer button (both in standard confirmation flows and in the editable split branch viadebouncedFormError):const isSuppressedInline = (error: TranslationPaths | ''): boolean => error === 'iou.error.invalidMerchant' || (!isDistanceRequest && error === 'common.error.invalidAmount'); const translateFormError = (error: TranslationPaths): string => error === 'common.error.fieldRequired' ? translate('common.error.pleaseEnterRequiredFields') : translate(error);And in
computeErrorMessage():if (isTypeSplit && !shouldShowReadOnlySplits) { return debouncedFormError && !isSuppressedInline(debouncedFormError) ? translateFormError(debouncedFormError) : undefined; } ... return formError ? translateFormError(formError) : undefined;This guarantees:
- Inline fields (
AmountField,DateField,MerchantField) still inspectformError === 'common.error.fieldRequired'and display their per-field inline"This field is required"error. ConfirmationFooterContentreceiveserrorMessage = "Please enter the required fields."and renders it inFormHelpMessagedirectly above the footer button, even when the invalid field is scrolled out of view.- As soon as all required fields (
Amount,Date,Merchant) are filled, the existinguseEffectinuseFormErrorManagement.ts:229-236setssetFormError('')and clears both the inline errors and the footer summary. - We will also update
tests/unit/useFormErrorManagementTest.tsandtests/unit/useConfirmationValidationTest.tsto cover the new footer summary message and auto-clearing behavior.
- Inline fields (
What alternative solutions did you explore? (Optional)
- Only checking
formError === 'common.error.fieldRequired'without updating the blank required merchant branch inuseConfirmationValidation.ts: rejected because a manual workspace expense with valid Amount and Date but a blank Merchant returns'iou.error.invalidMerchant', which would leave the footer blank despiteMerchantField.tsx:89already being wired forformError === 'common.error.fieldRequired'.
Proposal
Please re-state the problem that we are trying to solve in this issue.
When creating an expense (e.g. Spend > Reports > More > Create Expense), if a required field such as Amount is missing and scrolled out of view, clicking Save Expense appears to do nothing — the save is correctly blocked, but the inline error is off-screen so the user gets no explanation.
What is the root cause of that problem?
The confirmation step validates required fields on submit and blocks the save, but the only feedback is the field-level inline error. There is no validation summary near the footer button, so when the invalid field is outside the viewport the blocked submit looks like an unresponsive button.
What changes do you think are needed to solve the problem?
In IOURequestStepConfirmation, when submit validation fails, render a visible validation summary immediately above the footer button — "Please enter the required fields." with the standard error indicator — listing that required fields are missing. Keep the existing inline errors on the affected fields, keep invalid submissions blocked (no bypass of validation), and clear the summary as soon as all required-field errors are corrected.
What alternative solutions did you explore?
Auto-scrolling to the first invalid field on failed submit — that helps, but on its own it still leaves the user without an explanation at the point where they clicked; the summary above the button is the requested behaviour and works whether or not scrolling happens. I will implement the summary as specified in the issue's acceptance criteria.
What will you do to verify the fix?
Reproduce the issue flow (amount left empty, scrolled out of view, click Save Expense) and confirm the summary appears above the footer button; confirm the summary also makes sense when the field is visible; correct the field and confirm the summary clears and the expense saves normally; run the existing IOU confirmation tests.
Proposal
Please re-state the problem that we are trying to solve in this issue
When creating/editing an expense (e.g. Spend › Reports › More › Add Expense › Create Expense), if a required field (Amount, Date, or Merchant) is missing and the field is scrolled outside the viewport, clicking Save Expense appears unresponsive. The save is correctly blocked by validation, but computeErrorMessage() in useFormErrorManagement.ts suppresses the common.error.fieldRequired / iou.error.invalidMerchant / common.error.invalidAmount errors from the footer FormHelpMessage, so no validation summary is rendered above the footer button.
What is the root cause of that problem?
In src/components/MoneyRequestConfirmationList/hooks/useFormErrorManagement.ts:268-278:
const isSuppressedInline = (error: TranslationPaths | ''): boolean =>
error === 'common.error.fieldRequired' || error === 'iou.error.invalidMerchant' || (!isDistanceRequest && error === 'common.error.invalidAmount');
const computeErrorMessage = (): string | undefined => {
if (routeError) {
return routeError;
}
// This runs ahead of the split branch below ...
if (isSuppressedInline(formError)) {
return undefined;
}
...
isSuppressedInline returns true for common.error.fieldRequired, meaning computeErrorMessage() returns undefined. ConfirmationFooterContent.tsx receives no errorMessage and renders an empty FormHelpMessage above the footer button. If the invalid field is out of view, the user has zero feedback that anything is wrong.
The existing suppression rationale (documented in lines 263-267) is sound for the normal case — the inline field error already says "This field is required," so showing it again in the footer is redundant. But it breaks down when the field is scrolled off-screen: there is no visible error at all, and the button looks dead.
What changes do you think we should make in order to solve the problem?
1. Add a localization key in src/languages/en.ts (and all locale files: es.ts, fr.ts, de.ts, pt-BR.ts, etc.):
// under common.error:
pleaseEnterRequiredFields: 'Please enter the required fields.',
2. Update computeErrorMessage() in useFormErrorManagement.ts so that the three currently-suppressed "inline" errors (fieldRequired, invalidMerchant, non-distance invalidAmount) are surfaced as the summary message above the footer button instead of being silently dropped:
const isSuppressedInline = (error: TranslationPaths | ''): boolean =>
error === 'common.error.fieldRequired' || error === 'iou.error.invalidMerchant' || (!isDistanceRequest && error === 'common.error.invalidAmount');
const computeErrorMessage = (): string | undefined => {
if (routeError) {
return routeError;
}
// These errors are also shown inline on their respective fields, but when the field is
// scrolled out of view the user gets no feedback at all. Surface a summary message above
// the footer button so the blocked submit is always explained.
if (isSuppressedInline(formError)) {
return translate('common.error.pleaseEnterRequiredFields');
}
if (isTypeSplit && !shouldShowReadOnlySplits) {
if (isSuppressedInline(debouncedFormError)) {
return translate('common.error.pleaseEnterRequiredFields');
}
return debouncedFormError ? translate(debouncedFormError) : undefined;
}
if (formError === 'violations.missingAttendees') {
return undefined;
}
if (formError === 'iou.error.invalidTaxAmount') {
return undefined;
}
return formError ? translate(formError) : undefined;
};
Key design points:
- The distance-amount exception (
!isDistanceRequest && error === 'common.error.invalidAmount') is preserved: distance requests still surfaceinvalidAmountvia both the inline field and the footer (since the distance-amount field has no inline surface), while non-distanceinvalidAmountnow shows the summary instead of nothing. - Inline errors are preserved: the affected field components (
AmountField,DateField,MerchantField) independently checkformError === 'common.error.fieldRequired'and display their own inline "This field is required" message. TheformErrorstate itself is unchanged; only the footer message changes fromundefinedto the summary. - Split flows: the debounced branch is updated symmetrically so split-bill confirmation also shows the summary.
3. Auto-clearing: The existing useEffect at lines 229-236 already clears formError to '' as soon as isAmountRequiredMissing, isDateRequiredMissing, and isMerchantRequiredMissing are all false. Since the footer message is derived from formError via computeErrorMessage(), clearing formError automatically clears the footer summary. No additional clearing logic is needed.
4. Submission blocking preserved: useConfirmationValidation still returns the error key and blocks submission. The fix only changes what is displayed, not what is validated.
What specific scenarios should be covered by automated tests?
formError === 'common.error.fieldRequired'→errorMessagereturns'Please enter the required fields.'(standard flow)formError === 'iou.error.invalidMerchant'→errorMessagereturns the summary (non-split, merchant required + empty)formError === 'common.error.invalidAmount'(non-distance) →errorMessagereturns the summaryformError === 'common.error.invalidAmount'(distance request) →errorMessagereturnstranslate('common.error.invalidAmount')(unchanged — distance amount still surfaces in footer)- Split flow:
debouncedFormError === 'common.error.fieldRequired'→errorMessagereturns the summary - All required fields filled →
formErrorcleared,errorMessagereturnsundefined routeErrorset →errorMessagereturnsrouteError(unchanged priority)
What alternative solutions did you explore?
- Only show the summary when the field is out of view (detect scroll position): rejected — detecting viewport visibility of a specific field is fragile, platform-dependent, and adds unnecessary complexity. The summary message is useful even when the field is visible (it confirms which action is blocked), matching the acceptance criterion "The error is also understandable when the affected field is visible."
- Auto-scroll to the first invalid field: considered as a complement, but the issue explicitly asks for a visible validation summary above the footer button. Auto-scroll alone doesn't satisfy the acceptance criteria when multiple fields are missing.
PR
PR will be linked here once assigned.
Proposal
Please re-state the problem that we are trying to solve in this issue.
On the expense confirmation page (Create Expense / Save Expense), when a required field (Amount, Merchant, or Date) is missing and the user scrolls down and taps the footer submit button while that required field is scrolled out of view, no validation error message is displayed above the footer button. As a result, tapping the submit button appears to do nothing when the inline field error is off-screen.
What is the root cause of that problem?
In src/components/MoneyRequestConfirmationList/hooks/useFormErrorManagement.ts (lines 27–38), computeErrorMessage() explicitly suppresses field-level required errors from being returned as formError:
- It defines
isSuppressedInline = error === 'common.error.fieldRequired' || (!isDistanceRequest && error === 'common.error.invalidAmount') || error === 'iou.error.invalidMerchant'and returns''wheneverisSuppressedInlineistrue.
Because computeErrorMessage() returns '' for those errors, formError passed into src/components/MoneyRequestConfirmationList/ConfirmationFooterContent.tsx (lines 90–103) is empty, so ConfirmationFooterContent does not render a FormHelpMessage above the Button in the sticky footer. When the user is on a smaller viewport or has many fields (tags, categories, attendees, tax, etc.) and the invalid Amount, Merchant, or Date row is scrolled out of view, the inline error on the MenuItemWithTopDescription cannot be seen and the footer shows no feedback at all.
What changes do you think we should make in order to solve the problem?
In src/components/MoneyRequestConfirmationList/hooks/useFormErrorManagement.ts (and src/components/MoneyRequestConfirmationList/ConfirmationFooterContent.tsx):
- Update
computeErrorMessage()inuseFormErrorManagement.tsso that whenAmount,Merchant, orDatevalidation fails on submit (common.error.fieldRequired,common.error.invalidAmount, oriou.error.invalidMerchant),formErroris populated (for example with the corresponding translated error message or'common.error.fieldRequired'/ specific field error message) instead of returning'', soConfirmationFooterContent.tsxrenders theFormHelpMessagedirectly above the footer confirm button alongside the inline field error. - Ensure
clearFormErrorsinuseFormErrorManagement.tscontinues to clearformErroras soon as the user edits the missingAmount,Merchant, orDatefield.
What alternative solutions did you explore? (Optional)
We also considered auto-scrolling the ScrollView back to the top when a required field error occurs, but the issue specifically requests showing the required-field validation error message above the footer button so users immediately see why submission is blocked at their current scroll position.
📣 @jeffrey-graham! 📣 Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork. Please follow these steps:
- Make sure you've read and understood the contributing guidelines.
- Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
- Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
- Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>
Proposal
Please re-state the problem that we are trying to solve in this issue.
On the expense creation confirmation screen, when a user attempts to submit an expense with one or more required fields missing (such as Merchant or Amount), only inline field-level "This field is required" errors appear on the individual list rows. We also need to display a general validation error message ("Please enter the required fields.") in the footer above the primary submit button, and automatically clear it once all required fields are filled.
What is the root cause of that problem?
There are two connected causes in src/components/MoneyRequestConfirmationList/hooks/useFormErrorManagement.ts and src/components/MoneyRequestConfirmationList/hooks/useConfirmationValidation.ts:
-
computeErrorMessage()suppresses required-field errors from the footer: Insrc/components/MoneyRequestConfirmationList/hooks/useFormErrorManagement.ts(lines 268-278):const isSuppressedInline = (error: string) => error === 'common.error.fieldRequired' || error === 'iou.error.invalidMerchant' || (!isDistanceRequest && error === 'common.error.invalidAmount'); const computeErrorMessage = (): string | undefined => { if (routeError) { return routeError; } if (!formError || isSuppressedInline(formError)) { return undefined; } return translate(formError); };When required fields are missing on submit,
useConfirmationValidation.tssetsformErrorto either:'common.error.fieldRequired'(whenshouldShowFieldRequiredErroris true — e.g. missing category, tag, description, tax, missing scan merchant, or missing manual amount atlines 195-204), or'iou.error.invalidMerchant'(when a manual expense on a workspace withisMerchantRequired === truehas a valid amount and date, soshouldShowFieldRequiredErrorisfalse, and execution reacheslines 177-192ofuseConfirmationValidation.tswhereisMerchantEmpty || isUntypedPlaceholderMerchant(...)setssetFormError('iou.error.invalidMerchant')).
Because
isSuppressedInlinereturnstruefor both'common.error.fieldRequired'and'iou.error.invalidMerchant',computeErrorMessage()returnsundefined, andConfirmationFooterContent.tsx(lines 194-200) renders noFormHelpMessageabove theButton. -
Auto-clearing
formErrorinuseFormErrorManagement.tsmisses manual required merchants (isMerchantRequired): Insrc/components/MoneyRequestConfirmationList/hooks/useFormErrorManagement.ts(lines 221-236), the effect that clears'common.error.fieldRequired'when all required fields are filled defines:const isMerchantRequiredMissing = isConfirmationMerchantMissing;where
isConfirmationMerchantMissing(lines 147-152) only checks partially entered Scan requests (isScanRequest(transaction)):const isConfirmationMerchantMissing = useMemo(() => { if (!hasAttemptedConfirm || !isScanRequest(transaction) || isMovingTransactionFromTrackExpense || !hasSmartScanFailedWithMissingFields) { return false; } return !trimmedMerchant || isUntypedPlaceholderMerchant(transaction?.isMerchantSet, trimmedMerchant); }, [...]);For a manual expense on a workspace where
isMerchantRequiredistrue,isConfirmationMerchantMissingis alwaysfalse! As a result:- If both Amount and Merchant are empty on a manual workspace expense, clicking Create sets
formError = 'common.error.fieldRequired'. As soon as the user fills in only Amount (while Merchant is still empty),isAmountRequiredMissingbecomesfalseandisMerchantRequiredMissingis alreadyfalse, solines 229-235prematurely clearformErroreven though the required Merchant is still missing! - Conversely, if Amount was already filled and only Merchant was empty, clicking Create sets
formError = 'iou.error.invalidMerchant', which is already cleared when Merchant becomes non-empty atlines 204-208.
- If both Amount and Merchant are empty on a manual workspace expense, clicking Create sets
What changes do you think we should make in order to solve the problem?
-
Add the translation key
common.error.pleaseEnterRequiredFieldsinsrc/languages/en.ts(and corresponding locale files):pleaseEnterRequiredFields: 'Please enter the required fields.', -
Include manual required merchant in
isMerchantRequiredMissinginsrc/components/MoneyRequestConfirmationList/hooks/useFormErrorManagement.ts(lines 204-236): Compute whether a manual required merchant is missing and include it inisMerchantRequiredMissingso'common.error.fieldRequired'stays active until the required merchant is also filled:const isManualMerchantRequiredMissing = Boolean( isMerchantRequired && (!trimmedMerchant || isUntypedPlaceholderMerchant(transaction?.isMerchantSet, trimmedMerchant)), ); const isMerchantRequiredMissing = isConfirmationMerchantMissing || isManualMerchantRequiredMissing; -
Return
translate('common.error.pleaseEnterRequiredFields')fromcomputeErrorMessage()insrc/components/MoneyRequestConfirmationList/hooks/useFormErrorManagement.ts(lines 268-281): WhenformErrorrepresents a required-field validation failure (formError === 'common.error.fieldRequired'orformError === 'iou.error.invalidMerchant'whenisMerchantRequiredMissingis true), returntranslate('common.error.pleaseEnterRequiredFields')soConfirmationFooterContentdisplays"Please enter the required fields."above the submit button while keeping inline field-level"This field is required"messages intact:const isRequiredFieldFormError = formError === 'common.error.fieldRequired' || (formError === 'iou.error.invalidMerchant' && isMerchantRequiredMissing); const isSuppressedInline = (error: string) => error === 'iou.error.invalidMerchant' || (!isDistanceRequest && error === 'common.error.invalidAmount'); const computeErrorMessage = (): string | undefined => { if (routeError) { return routeError; } if (isRequiredFieldFormError) { return translate('common.error.pleaseEnterRequiredFields'); } if (!formError || isSuppressedInline(formError)) { return undefined; } return translate(formError); };
What alternative solutions did you explore? (Optional)
- Changing
useConfirmationValidation.tsto setformError = 'common.error.pleaseEnterRequiredFields'directly:useFormErrorManagement.tschecksformError === 'common.error.fieldRequired'andformError === 'iou.error.invalidMerchant'in several effects and inline error computations (getMerchantErrorMessage,showConfirmAmountError, auto-clear effects). Keeping the internalformErrorstate codes unchanged and mapping required-field errors totranslate('common.error.pleaseEnterRequiredFields')incomputeErrorMessage()avoids breaking any existing inline field validation checks.
Proposal
What is the root cause of that problem?
In src/components/MoneyRequestConfirmationList/ConfirmationFooterContent.tsx and ConfirmationListLayout.tsx:
- When a required field (such as Amount, Merchant, or Date) is missing or invalid on an expense confirmation screen, validation sets inline errors on the specific field component (in
formError/errorFields). - If the user is viewing the bottom of the form or if the fields are scrolled out of the visible viewport, clicking the primary submit button ("Create Expense" / "Save Expense") blocks submission, but provides no visual feedback in the footer area near the button.
- The submit button in
ConfirmationFooterContentdoes not passformErrorto a footer alert component (such asFormAlertWithSubmitButtonorDotIndicatorMessageabove the button), causing the tap to appear completely unresponsive to the user.
What changes do you think we should make in order to solve the problem?
- In
src/components/MoneyRequestConfirmationList/ConfirmationFooterContent.tsx, acceptformError/ validation error summary and display aDotIndicatorMessage(or render the button viaFormAlertWithSubmitButton/FormHelpMessage) directly above the submit button. - When the user taps the submit button and required field validation fails:
- Display a generic or field-specific validation error message (e.g.
common.pleaseFillAllRequiredFieldsor the first active field error) above the footer button. - Automatically scroll the
SelectionListWithSectionsto the first invalid field so the user is immediately brought to the missing field.
- Display a generic or field-specific validation error message (e.g.
What alternative solutions did you explore? (Optional)
Only scrolling to the invalid field without displaying a footer message. However, displaying the validation message directly above the footer button provides immediate feedback right at the point of interaction, matching Expensify's UX guidelines across form submissions.
Contributor Details
Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~0179cdc82689f205c7
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
Proposal
Please re-state the problem that we are trying to solve in this issue.
When creating or confirming an expense (for example via Spend > Reports > More > Add Expense > Create Expense), if a required field such as Amount, Date, or Merchant is missing and scrolled out of the visible viewport, clicking Save Expense / Create Expense appears to do nothing because the inline field error is off-screen and no validation summary message is shown above the footer button.
What is the root cause of that problem?
In src/components/MoneyRequestConfirmationList/hooks/useFormErrorManagement.ts:
-
computeErrorMessage()(lines 268-295) suppresses required-field errors from the footer:const isSuppressedInline = (error: TranslationPaths | ''): boolean => error === 'common.error.fieldRequired' || error === 'iou.error.invalidMerchant' || (!isDistanceRequest && error === 'common.error.invalidAmount'); const computeErrorMessage = (): string | undefined => { if (routeError) { return routeError; } // This runs ahead of the split branch below because splits render those same inline fields, so they duplicate the same way. if (isSuppressedInline(formError)) { return undefined; }When required fields are missing on confirm,
useConfirmationValidation.tssetsformErrorto either'common.error.fieldRequired'(when Amount, Date, or a partially manually entered Scan Merchant is missing) or'iou.error.invalidMerchant'(when a manual workspace expense withisMerchantRequired === truehas a valid Amount and Date, soshouldShowFieldRequiredErrorisfalse, anduseConfirmationValidation.tsfalls through to the merchant check). BecauseisSuppressedInline(formError)returnstruefor both,computeErrorMessage()returnsundefined, andConfirmationFooterContent.tsxrenders noFormHelpMessageabove the submit button. -
Blank required merchants on manual workspace expenses are not tracked by
isMerchantRequiredMissing(line 228):- At line 228,
isMerchantRequiredMissingis computed viaisConfirmationMerchantMissing(transaction, canEnterScanFieldsManually, isPolicyExpenseChat). - However, in
src/libs/MoneyRequestUtils.ts:279,isConfirmationMerchantMissingchecksisPartiallyEnteredScanExpense(...), which is onlytruewhenisScanRequest(transaction)istrue. - For a manual workspace expense (
isScanRequest === false,isMerchantRequired === true),isConfirmationMerchantMissingis alwaysfalse. Consequently:- If both Amount and Merchant are left blank on a manual workspace expense and the user clicks Create Expense,
formErroris set to'common.error.fieldRequired'. As soon as the user fills in Amount (while Merchant is still blank), the auto-clearuseEffectat lines 229–236 seesisAmountRequiredMissing === false,isDateRequiredMissing === false, andisMerchantRequiredMissing === false, and prematurely clearsformErrorto''while the required Merchant is still empty! - Conversely, if Merchant has a non-empty invalid value (such as exceeding
CONST.MERCHANT_NAME_MAX_BYTES= 255 bytes),formErroris'iou.error.invalidMerchant'with a typed merchant, which should remain suppressed inline rather than displaying"Please enter the required fields.".
- If both Amount and Merchant are left blank on a manual workspace expense and the user clicks Create Expense,
- At line 228,
What changes do you think we should make in order to solve the problem?
- Add the translation key
common.error.pleaseEnterRequiredFields('Please enter the required fields.') insrc/languages/en.ts(and the other language files). - In
src/components/MoneyRequestConfirmationList/hooks/useFormErrorManagement.ts:- Compute
isUntypedMerchant(!trimmedMerchant || isUntypedPlaceholderMerchant(transaction?.isMerchantSet, trimmedMerchant)) and include(isMerchantRequired && isUntypedMerchant)inisMerchantRequiredMissingso thatcommon.error.fieldRequiredstays active until a required manual merchant is also filled in. - Define
isRequiredFieldError(error === 'common.error.fieldRequired' || (error === 'iou.error.invalidMerchant' && isMerchantRequiredMissing)) and returntranslate('common.error.pleaseEnterRequiredFields')incomputeErrorMessage()beforeisSuppressedInline(formError).
- Compute
What alternative solutions did you explore? (Optional)
- Returning
translate('common.error.pleaseEnterRequiredFields')for allisSuppressedInlineerrors: Rejected because non-empty invalid field values (e.g. a merchant exceeding 255 bytes or an invalid non-empty amount) are invalid-value errors rather than missing required fields. CheckingisRequiredFieldError(formError)ensures"Please enter the required fields."is shown only when required fields are actually missing, and clears immediately once all required fields are entered.
📣 @cocvn157! 📣 Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork. Please follow these steps:
- Make sure you've read and understood the contributing guidelines.
- Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
- Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
- Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>
Proposal
Please re-state the problem that we are trying to solve in this issue.
When creating or editing an expense (for example via Spend > Reports > More > Add Expense > Create Expense, or manual/scan confirmation), if a required field (Amount, Date, or Merchant) is missing and scrolled outside the visible viewport, clicking the footer button (Save Expense / Create Expense) appears unresponsive because the inline field error is off-screen and no validation feedback is rendered near the footer button.
What is the root cause of that problem?
In src/components/MoneyRequestConfirmationList/hooks/useFormErrorManagement.ts:
- When required fields are missing on confirmation,
useConfirmationValidationdetects the invalid condition and returns{errorKey: 'common.error.fieldRequired'}(or{errorKey: 'iou.error.invalidMerchant'}whenisMerchantRequired && isMerchantEmpty). - However, in
useFormErrorManagement.ts:const isSuppressedInline = (error: TranslationPaths | ''): boolean => error === 'common.error.fieldRequired' || error === 'iou.error.invalidMerchant' || (!isDistanceRequest && error === 'common.error.invalidAmount'); const computeErrorMessage = (): string | undefined => { if (routeError) { return routeError; } if (isSuppressedInline(formError)) { return undefined; } ...isSuppressedInlinewas originally added to prevent duplicating the field text "This field is required" at the bottom of the form when fields are visible. BecauseisSuppressedInline(formError)returnstruefor missing required fields,computeErrorMessage()evaluates toundefined. - Consequently, in
src/components/MoneyRequestConfirmationList/ConfirmationFooterContent.tsx:
no{!!errorMessage && ( <FormHelpMessage style={[styles.ph1, styles.mb2]} isError message={errorMessage} /> )}<FormHelpMessage>is displayed above the footer button, leaving the user without any indication of why saving is blocked when the field is outside the viewport.
What changes do you think we should make in order to solve the problem?
-
Add the translation key
common.error.pleaseEnterRequiredFields('Please enter the required fields.') tosrc/languages/en.tsandsrc/languages/es.ts:// src/languages/en.ts pleaseEnterRequiredFields: 'Please enter the required fields.', // src/languages/es.ts pleaseEnterRequiredFields: 'Por favor, ingrese los campos obligatorios.', -
In
src/components/MoneyRequestConfirmationList/hooks/useFormErrorManagement.ts:- Identify missing required field errors with a helper:
const isRequiredFieldMissing = (error: TranslationPaths | ''): boolean => error === 'common.error.fieldRequired' || (error === 'iou.error.invalidMerchant' && isMerchantRequired && isMerchantEmpty); - In
computeErrorMessage():- For split requests (
isTypeSplit && !shouldShowReadOnlySplits): ifisRequiredFieldMissing(debouncedFormError), returntranslate('common.error.pleaseEnterRequiredFields'). - For non-split requests: if
isRequiredFieldMissing(formError), returntranslate('common.error.pleaseEnterRequiredFields'). - Non-empty invalid inputs (e.g. non-distance invalid amounts or a merchant string exceeding
CONST.MERCHANT_NAME_MAX_BYTES= 255 bytes) continue throughisSuppressedInline(formError)to remain suppressed inline.
- For split requests (
--- a/src/components/MoneyRequestConfirmationList/hooks/useFormErrorManagement.ts +++ b/src/components/MoneyRequestConfirmationList/hooks/useFormErrorManagement.ts @@ -268,11 +268,20 @@ function useFormErrorManagement({ const isSuppressedInline = (error: TranslationPaths | ''): boolean => error === 'common.error.fieldRequired' || error === 'iou.error.invalidMerchant' || (!isDistanceRequest && error === 'common.error.invalidAmount'); + const isRequiredFieldMissing = (error: TranslationPaths | ''): boolean => + error === 'common.error.fieldRequired' || (error === 'iou.error.invalidMerchant' && isMerchantRequired && isMerchantEmpty); + const computeErrorMessage = (): string | undefined => { if (routeError) { return routeError; } + if (isTypeSplit && !shouldShowReadOnlySplits) { + if (isRequiredFieldMissing(debouncedFormError)) { + return translate('common.error.pleaseEnterRequiredFields'); + } + return debouncedFormError && !isSuppressedInline(debouncedFormError) ? translate(debouncedFormError) : undefined; + } + if (isRequiredFieldMissing(formError)) { + return translate('common.error.pleaseEnterRequiredFields'); + } // This runs ahead of the split branch below because splits render those same inline fields, so they duplicate the same way. if (isSuppressedInline(formError)) { return undefined; } - if (isTypeSplit && !shouldShowReadOnlySplits) { - // Splits render the debounced value, so the suppression has to be re-checked against it. `formError` clears - // the instant the user fixes the field while `debouncedFormError` lags by USE_DEBOUNCED_STATE_DELAY, and - // without this the suppressed error would pop into the footer for that window (#96565). - return debouncedFormError && !isSuppressedInline(debouncedFormError) ? translate(debouncedFormError) : undefined; - } - Identify missing required field errors with a helper:
-
Behavior and Auto-clearing:
- The specific inline errors on the individual field components (
AmountField,DateField,MerchantField) remain untouched and continue displaying their specific messages. - When the user fills in the missing required field(s), the existing auto-clear
useEffecthooks inuseFormErrorManagement.ts(lines 217–222 for merchant, and lines 229–236 for amount/date) automatically resetformErrorto''. This setserrorMessageback toundefined, immediately clearing<FormHelpMessage>above the footer button and unblocking confirmation.
- The specific inline errors on the individual field components (
What alternative solutions did you explore? (Optional)
- Returning
translate('common.error.pleaseEnterRequiredFields')for allisSuppressedInlineerrors: Rejected because non-empty invalid values (such as an invalid non-empty amount or a merchant string exceeding 255 bytes) are invalid-format errors rather than missing required fields; they already render specific inline feedback. CheckingisRequiredFieldMissingensures the summary message specifically explains missing required fields as requested in the issue discussion.
Contributor details
Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~0105126232377c4c5c
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
@TaduJR please move forward with Melvin for this, or add Help wanted and evaluate proposal from the community. Thanks.
@trjExpensify
Was already working this. Will finish reviewing after some hours.
Thanks!
@MelvinBot
Please post a proposal