question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

action formData not working as expected with modals.

See original GitHub issue

What version of Remix are you using?

1.4.1

Steps to Reproduce

Build a multi-form route but with each form rendered in a modal pop-up. Reproduction: https://stackblitz.com/edit/github-fn9naa?file=app%2Froutes%2Finvitations.tsx

The work around is to pass an hidden input that holds the value and name of the button. Workaround: https://stackblitz.com/edit/github-fn9naa-shsnbv?file=app%2Froutes%2Finvitations.tsx

Expected Behavior

When building a form within a modal. I would expect formData to have the same shape as it would without the modal.

formData: { email: 'asdf@asdf.com', _action: 'send' }

Actual Behavior

The formData loses the value for the button.

formData: { email: 'asdf@asdf.com' }

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
github-actions[bot]commented, May 18, 2022

🤖 Hello there,

We just published version v1.5.0 which involves this issue. If you’d like to take it for a test run please try it out and let us know what you think!

Thanks!

1reaction
mcanshcommented, May 3, 2022

@rodrigofuentes, my apologies, it works in safari, but not Firefox or Chrome 😅

it does work however in all 3 if you use reloadDocument, which submits it using a document request instead of client side with javascript, so it’s something to do with our client side mutations, I’ve filed an internal ticket for this.

on a second pass, it seems that chrome nor firefox acknowledge the button name/value at all (i gave the form the id) image

this seems like a browser bug (not sure which side is “correct” though)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Form action event not working on popup - Stack Overflow
SImply remove it from the modal click event listener. Everything will work as expected. No additional code or triggering required. Working: ...
Read more >
FormData.append() - Web APIs | MDN
The append() method of the FormData interface appends a new value onto an existing key inside a FormData object, or adds the key...
Read more >
Form data loss prevention in React | by Evan Williams - Medium
One of the core problems we want to solve for our users is ensuring a proper balance between expected behavior and data loss...
Read more >
Form redirects not working as expected - Hotwire Discussion
Hey all, I've been integrating turbo-rails into my Rails application and things have been moving along just fine. I'm running into an issue ......
Read more >
Modals - Lightning Design System
(This scrolling is currently not available in Salesforce1 Mobile.) ... or “Close” button in the modal, or performs another action that closes the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found