Skip to content

[Regression]: v2 server functions retrieve URLSearchParams from form posts instead of FormData#2307

Description

@katywings

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Current behavior 馃槸

When making a form post to a server function without explicit enctype it's first param is a URLSearchParams object.

Expected behavior 馃

The server function should retrieve a FormData object from a form post.

Steps to reproduce 馃暪

From the basic template, change the index route to the code below, start the server and click on the Hello button:

import { Title } from "@solidjs/meta";
import { action } from "@solidjs/router";
import Counter from "~/components/Counter";

const hello = action(async (data: FormData) => {
  "use server"

  console.log(data)
}, 'hello')

export default function Home() {
  return (
    <main>
      <Title>Hello World</Title>
      <h1>Hello world!</h1>
      <Counter />
      <form>
        <input name="name" value="james" />
        <button name="hello" value="world" formAction={hello} formMethod="post">Hello</button>
      </form>
      <p>
        Visit{" "}
        <a href="https://start.solidjs.com" target="_blank">
          start.solidjs.com
        </a>{" "}
        to learn how to build SolidStart apps.
      </p>
    </main>
  );
}

Context 馃敠

No response

Your environment 馃寧

OS: Linux
Browser: Zen (Firefox)
Node: v24.18.0

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions