Skip to content

instance.fields.value() not getting value from submitter #15908

Open

Description

@lettucebowler

Describe the bug

Remote form enhance callback does not get the value from the submit button in instance.fields.value(). Repro linked below shows that the remote handler gets the value, but not the enhance callback. The submitter value was present in the deprecated data value prior to 2.61.

Reproduction

https://stackblitz.com/edit/sveltejs-kit-template-default-wd3pxphe?file=src%2Froutes%2Fform.remote.ts

Logs

System Info

System:
    OS: Linux 5.15 Ubuntu 24.04.4 LTS 24.04.4 LTS (Noble Numbat)
    CPU: (16) x64 AMD Ryzen 7 9800X3D 8-Core Processor
    Memory: 25.66 GB / 31.16 GB
    Container: Yes
    Shell: 5.9 - /usr/bin/zsh
  Binaries:
    Node: 24.9.0 - /home/lettucebowler/.volta/tools/image/node/24.9.0/bin/node
    npm: 11.6.0 - /home/lettucebowler/.volta/tools/image/node/24.9.0/bin/npm
    pnpm: 10.30.3 - /home/lettucebowler/.volta/bin/pnpm
    bun: 1.2.2 - /home/lettucebowler/.bun/bin/bun
  npmPackages:
    @sveltejs/adapter-auto: ^7.0.1 => 7.0.1 
    @sveltejs/kit: ^2.57.0 => 2.61.1 
    @sveltejs/vite-plugin-svelte: ^7.0.0 => 7.1.2 
    svelte: ^5.55.2 => 5.55.9 
    vite: ^8.0.7 => 8.0.14

Severity

blocking an upgrade

Additional Information

No response

Activity

  1. lettucebowler commented on Jun 3, 2026

    @lettucebowler
    ContributorAuthor

    instance.fields.value() relies on the handle_input event handler to listen to inputs and update the value each time an input even happens. This doesn't work for forms with multiple named submit buttons because they don't trigger that event to fire.

    One potential option to resolve this is to check if the event.submitter is a button with a name and value and update the state within handle_submit. That could be achieved with something like this:

    if (event.submitter instanceof HTMLButtonElement && event.submitter.name && event.submitter.value !== undefined) {
      set_nested_value(input, event.submitter.name, event.submitter.value);
    }

    I imagine more would need to happen beyond this to ensure validation, populating issues, etc,

    I do have to say though that this feels way more complicated than the pre-2.61 approach where the enhance callback had access to the data

  2. lettucebowler commented on Jun 5, 2026

    @lettucebowler
    ContributorAuthor

    jk this doesn't actually solve it because it doesn't clear if you hit a different submit button. that complexity really makes me lean more towards trying to take advantage of the already existing form_data in handle_submit

  3. added
    bugSomething isn't working
    formsStuff relating to forms and form actions
    and removed
    bugSomething isn't working
    on Aug 4, 2026
  4. added theissue type on Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    formsStuff relating to forms and form actions

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions