damianricobelli / stepperize

A library for creating step-by-step workflows in your apps
https://stepperize.vercel.app
916 stars 40 forks source link

Examples for a form with server actions #40

Closed iljapanic closed 2 months ago

iljapanic commented 2 months ago

Thank you for a great stepper library. It was quite straightforward to get a multistep form flow working with react-hook-form and zod via shadcn components. However, I'm having difficulties triggering server actions via the form submit.

The culprit seems to be in the <form onSubmit={form.handleSubmit(onSubmit)}> which is not getting triggered when clicking the submit button which is nested in the final step like so:

{stepper.when('email', () => (
  <Slide>
    <Email form={form} />
    <Button type="submit">
      Submit
    </Button>
  </Slide>
))}

Can you point me to an example with nextjs server actions and shadcn form component? I understand this is being added to the documentation soon, but I was wondering if there is a dev branch or PR that I could take a look at meanwhile before posting all of my convoluted code samples here.

iljapanic commented 2 months ago

Nevermind, I've jumped the gun here… it was a validation error and my form submission was silently failing.

My apologies. I'm closing this issue and feel free to delete it entirely.

Thank you one more time for such a nifty little component.

damianricobelli commented 2 months ago

I'm glad you were able to solve it! Stay tuned for the next versions, features are coming that will surely make it even easier to use.