Home / Function/ demoFormAction() — ui Function Reference

demoFormAction() — ui Function Reference

Architecture documentation for the demoFormAction() function in form-next-demo-action.ts from the ui codebase.

Entity Profile

Dependency Diagram

graph TD
  b1636fbc_5c48_8cd2_fcc1_53a19f19af40["demoFormAction()"]
  ef956916_247d_d591_7cc9_ba24c57b1db9["form-next-demo-action.ts"]
  b1636fbc_5c48_8cd2_fcc1_53a19f19af40 -->|defined in| ef956916_247d_d591_7cc9_ba24c57b1db9
  style b1636fbc_5c48_8cd2_fcc1_53a19f19af40 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/v4/registry/new-york-v4/examples/form-next-demo-action.ts lines 5–35

export async function demoFormAction(
  _prevState: FormState,
  formData: FormData
) {
  const values = {
    title: formData.get("title") as string,
    description: formData.get("description") as string,
  }

  const result = formSchema.safeParse(values)

  if (!result.success) {
    return {
      values,
      success: false,
      errors: result.error.flatten().fieldErrors,
    }
  }

  // Do something with the values.
  // Call your database or API here.

  return {
    values: {
      title: "",
      description: "",
    },
    errors: null,
    success: true,
  }
}

Subdomains

Frequently Asked Questions

What does demoFormAction() do?
demoFormAction() is a function in the ui codebase, defined in apps/v4/registry/new-york-v4/examples/form-next-demo-action.ts.
Where is demoFormAction() defined?
demoFormAction() is defined in apps/v4/registry/new-york-v4/examples/form-next-demo-action.ts at line 5.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free