SvelteKit form redirect from widget

14 Views Asked by At

I am trying to set up a form widget in a page footer with SvelteKit. I have set the action to action="/contact?/contact" to direct the action to my existing contact form +page.server.js, but it redirects to the contact page when not using use:enhance.

It works find with use:ehance set up like below. My goal is to get the server reply directly from #page.form and not redirect without use:enhance enabled. Any assistance is appreciated.

`<form
   method="POST"
   action="/contact?/contact"
   use:enhance={() => {
   return async ({ result }) => {
     form = result.data;
   };
   }}
  >
  inputs here
  {#if form.error}
     show error
  {/if}
 </form>`
0

There are 0 best solutions below