imacrayon / alpine-ajax

An Alpine.js plugin for building server-powered frontends.
https://alpine-ajax.js.org
MIT License
558 stars 11 forks source link

Able to set `enctype` to application/x-www-form-urlencoded #51

Closed dephiros closed 6 months ago

dephiros commented 7 months ago

I have a simple form with one input value:

      <form x-data="{use_cache: $persist(false)}" x-effect="console.log(use_cache)" x-target="notion" method="post" action="/notion">
        <label>
          <input type="checkbox" name="use_cache" x-model="use_cache" />
          Use cache
        </label>
        <button>Fetch</button>
      </form>

The form seems to use multipart/form-data instead of the default application/x-www-form-urlencoded enctype Would it be possible to set enctype?

imacrayon commented 7 months ago

Yeah x-www-form-urlencoded should be our default too. It appears that using FormData with fetch has a different default. Thanks for reporting this, I’ll try to get to it soon.