glhd / alpine-wizard

Multi-step wizard helpers for Alpine.js
MIT License
148 stars 3 forks source link

Possible to create a Request Body or Multipart Requests? #1

Closed kartzke closed 2 years ago

kartzke commented 2 years ago

Hey, awesome project! Is it possible to send data as a request body, instead of all inputs being used as query params?

I have a scenario where I'm using a textarea input, which could have tens of thousands of words of free text. And in the future, I'd like my form to support file uploads. Possible to do Multipart requests?

Cheers Ryan

inxilpro commented 2 years ago

Yeah, you can do whatever you want with the form. alpine-wizard is really just there for presentation—you can write whatever logic you want. Just add the enctype attribute to the form and you're off.

I'm not 100% sure how Alpine handles file inputs. You may not be able to use x-model for them, in which case you'll need to wire things up by listening with @change. Depending on how big this textarea is, you may want to do something similar for it so that you're not holding 10,000's of words in JS memory needlessly. That will be up to you, though.