Global Form Data Validation Handling #7364
Unanswered
MentalGear
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Form Validation
Instead of doing form validation in each page file, I'd like to do validation once via a
"general form action"
hook/function (viahooks.server.ts
) and then let the request pass on to the specific route to work with the valid data.However, I'm not quite sure how a
page's export const actions: Actions
relates tohook's export const handle: Handle = async ({ event, resolve }) => {}
and how to add a general form handler inexport const handle: Handle
.I.e.:
User Input
-> Data Validation,hooks.server.ts
-> Data Use,Page.server.ts
Beta Was this translation helpful? Give feedback.
All reactions