Synchronize server validation
A server action returns validation feedback after processing submitted FormData.
Conform · Type Alias
SubmissionResult is the result shape Conform uses to synchronize a processed form submission with form state. It can include the processed submission, an applied target value, validation errors, and a reset instruction.
SubmissionResult describes the result that Conform uses to synchronize form state after processing a submission. It includes the processed submission and can additionally carry a target value, validation error, and reset instruction.
type SubmissionResult<ErrorShape = string[]> = {
submission: Submission;
targetValue?: Record<string, unknown>;
error?: FormError<ErrorShape> | null;
reset?: boolean;
};A SubmissionResult object containing the processed submission and optional target value, error, and reset state.
import type { SubmissionResult } from '@conform-to/react/future';
const result: SubmissionResult = {
submission: {
status: 'success',
payload: { email: 'dev@example.com' },
error: null,
reply() {
return new Response(null);
},
},
};This annotates a processed form result with the SubmissionResult type.
A server action returns validation feedback after processing submitted FormData.
A successful operation should replace or clear the value currently shown by the form.
A result must preserve the parsed submission while carrying field or form errors.
SubmissionResult represents the processed result of a form submission. It can contain the parsed submission plus optional targetValue, error, and reset fields.
Follow-up: How can a server result reach a form? Pass it as the lastResult option to useForm so Conform can synchronize the form state.
The submission property contains the processed submission object. Its payload may be changed when fields are hidden or files are removed.
Follow-up: Why might the payload differ from the original request? The report utility can strip files or hide selected fields before producing the result.
error carries validation information when supplied, while reset indicates that the form should return to its initial state. targetValue supplies a different value to apply to the form.
Follow-up: When is reset useful? It supports responses such as successfully creating an entry and then clearing the form.
reportuseFormdefineCustomStateSubmission