NuxtN
Nuxt4mo ago
31 replies
soymilk

NuxtUI Form Submit Issue

I'm using NuxtUI and the UForm element cannot be submitted. It says that e.preventDefault is not a function:

Here's a reproduction:
<template>
  <UForm
    :schema="z.object({ text: z.string() })"
    :state="formState"
    @error="(e) => console.log(e)"
    @submit="(e) => console.log(e)"
  >
    <UInput v-model="formState.text" name="text" />
    <UButton type="submit" label="Submit" />
  </UForm>
</template>
  
<script setup lang="ts">
import * as z from "zod";

const formState = ref({ text: "" });
</script>
Screenshot_2025-09-23_at_6.25.39_PM.png
Was this page helpful?