Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

Conform · Function

report

Creates a SubmissionResult from a parsed submission, optionally attaching validation errors and controlling returned values. It can reset the form, strip files, or hide sensitive fields.

How it works

report turns a parsed submission and optional result settings into a SubmissionResult. It can attach validation errors, provide a target form value, reset the form, remove file objects, and hide selected fields from the returned submission and target value.

Syntax

report(submission, options)

Parameters

NameTypeDescription
submissionSubmissionThe parsed submission to process.
optionsReportOptionsOptional settings controlling errors, target value, reset behavior, file preservation, and hidden fields.

Returns

A SubmissionResult containing the processed submission and any configured target value, error, or reset state.

Key points

  • report packages a submission together with validation information and optional file-stripping or field-hiding behavior.
  • Pass validation output with the error option.
  • Errors may be expressed separately as form-level errors, field-level errors, or both.
  • Use targetValue when the client should apply a different form value than the submitted payload.
  • The file-preservation option determines whether file objects remain in the returned submission payload.
  • hideFields removes selected fields from both returned value representations by replacing them with undefined.
  • Set reset when the client should restore the form to its initial state.

Common mistakes

  • The function is exported from Conform's future API, so its behavior may change between minor releases.
  • Use field hiding for sensitive values such as passwords; hidden fields become undefined in both returned values.

Example: Report validation errors

import { report } from '@conform-to/react/future';

const result = report(submission, {
  error: {
    fieldErrors: {
      email: ['Email is required'],
      password: ['Password must be at least 8 characters'],
    },
  },
});

Creates a submission result containing field-level validation errors.

When to use it

Return validation errors

A server action needs to return field-level validation messages after parsing submitted form data.

Apply a target value

A server action must apply a transformed or empty value instead of the submitted payload.

Reset after success

A successful mutation should tell the client to restore the initial form state.

Sanitize returned data

A response must avoid returning uploaded files or confidential fields.

Interview questions

QWhat does report return?

report accepts a parsed submission and optional settings, then returns a SubmissionResult. The result can include the processed submission, validation error information, a target value, and a reset flag.

Follow-up: How would you return schema errors? Pass the schema result's error payload through the error option; for schema validation, the default error shape is string[].

QHow are validation errors supplied?

Set error to an object containing formErrors and/or fieldErrors. Field errors map field names to error payloads, allowing the client to associate messages with individual controls.

Follow-up: How can you report only a form-level error? Supply error: { formErrors: ... } without field-level entries.

QHow do you prevent sensitive fields from being returned?

The hideFields option accepts field names and sets those fields to undefined in both the submission payload and target value. This is useful when the response must not expose sensitive data.

Follow-up: What other value transformations are supported? File preservation can be controlled separately, and targetValue can specify the value to apply or be set to null for an empty value.

  • SubmissionResult
  • Submission
  • parseSubmission
  • resolveSubmission

Source: report - conform.guide. Checked 2026-10-15.