Skip to content
This repository was archived by the owner on Sep 27, 2023. It is now read-only.
This repository was archived by the owner on Sep 27, 2023. It is now read-only.

How about FormData? #25

@verheyenkoen

Description

@verheyenkoen

I guess this doesn't work out-of-the-box with FormData (as zod doesn't really have a built-in way to work with FormData)?

Also, if it did and I wanted to create a regular form with a server action that posts the form data via Next.js, would there ever be a way to catch validation errors and display those cleanly within your form? Currently the docs suggest you can end that scenario only with redirect, revalidatePath and revalidateTag.

I know you can do this:

<form onSubmit={async (e) => {
   e.preventDefault();
   const myData = ...
   const response = await myServerAction(myData);
   // Deal with validation errors here
}}

but then we're spaghetticoding again, which the whole action={myServerAction} is trying to solve...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions