~/talk

Client-Side and Server-Side Form Validation in Nuxt with Daniel Kelly (Pt 2)

Talkat Frontend Nation 2024 · 2024-06-04..06-07· [vue, testing]
slides:none on file

Live coding shows a Nuxt registration flow that reuses one Zod schema for both client and server validation, including FormKit + Zod plugin integration, async refine checks against /api/user-exists, and custom messages for UX. Server uses H3 readValidatedBody and returns 422 with an issues array on failure. Uses z.coerce for numeric query inputs, switches to safeParseAsync when refine is async, and demonstrates prefilling valid form defaults from the URL with partial validation.

AI-written summary · about

  1. 0:00Form validation setup
  2. 1:49Zod validation rules
  3. 6:33Zod with FormKit client side
  4. 9:26Server-side validation with Zod
  5. 14:27Validation errors 422
  6. 21:21Async email check refine
  7. 27:10Prefill forms query params
  8. 38:44Q&A
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.