Skip to content
Discussion options

You must be logged in to vote

https://kit.svelte.dev/docs/form-actions#progressive-enhancement-use-enhance

To customise the behaviour, you can provide a
SubmitFunction
that runs immediately before the form is submitted, and (optionally) returns a callback that runs with the
ActionResult
. Note that if you return a callback, the default behavior mentioned above is not triggered.

<form
    method="POST"
    use:enhance={({ formElement, formData, action, cancel, submitter }) => {
        // `formElement` is this `<form>` element
        // `formData` is its `FormData` object that's about to be submitted
        // `action` is the URL to which the form is posted
        // calling `cancel()` will prevent the submission

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by PhanDungTri
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants