-
-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Serialize form using UrlSearchParams #26
Conversation
daun
commented
Aug 28, 2022
- Switch to native URLSearchParams API to serialize form data before submission
- Fixes Doesn't submit textareas #25
- Simplifies code and improves handling of edge cases
- Changes browser compatibility, so probably worth a major version
# Conflicts: # dist/SwupFormsPlugin.js # dist/SwupFormsPlugin.min.js # readme.md
While testing this PR I stumbled upon a possible bug: The form's get parameter isn't being replaced in the URL but instead appended. This leads to this if submitting a form multiple times:
https://test.rassohilber.com/swup-forms-plugin/test/ If you submit the form a few times you can see how the URL grows... and grows... :) This bug actually already existed before the edits in this branch. Should I take care of fixing this and just push it to this PR as well? Or too messy? |
@hirasso Right, nice catch! I've never come across this one as I always set the |
Looks like that's exactly what browsers do for GET requests: strip everything after the question mark. |
@hirasso I've fixed the mentioned bug and did some additional cleanup. Ready for review :) |