<button /> attribute "name" does not sent along with a <form /> submit request
Categories
(DevTools :: Netmonitor, defect)
Tracking
(firefox-esr91 wontfix, firefox96 wontfix, firefox97 wontfix, firefox98 wontfix)
People
(Reporter: pelagusrem, Unassigned)
Details
Attachments
(1 file)
264.82 KB,
image/png
|
Details |
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:97.0) Gecko/20100101 Firefox/97.0
Steps to reproduce:
Create an html form like so:
<form method="post">
<button name="button" value="value" type="submit">
submit
</button>
</form>
Click on the button.
Actual results:
Look at the "network tab" in the developer tools. Payload is empty.
Server does not receive the data either.
Expected results:
Form shoud send post request with form data that contain field "button" with value "value"
Comment 1•3 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'DevTools::Netmonitor' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.
Reporter | ||
Updated•3 years ago
|
Comment 2•3 years ago
|
||
Managed to reproduce this on Windows 10 x64, macOS 11.6 and on Ubuntu 20.04 x64.
Comment 3•3 years ago
•
|
||
Thank you for the report!
I can't reproduce the issue on my machine (I am seeing payload button="value"
).
Here is an online test case I am using
http://janodvarko.cz/tests/bugzilla/1753873/
Can you please try it and let me know how it works for you?
Hani, do you know what the test is doing wrong?
Reporter | ||
Comment 4•3 years ago
|
||
(In reply to Jan Honza Odvarko [:Honza] (always need-info? me) from comment #3)
Thank you for the report!
I can't reproduce the issue on my machine (I am seeing payload
button="value"
).
Here is an online test case I am using
http://janodvarko.cz/tests/bugzilla/1753873/Can you please try it and let me know how it works for you?
Hani, do you know what the test is doing wrong?
It is working for me. It seems I found the issue. The button data is not sent If there is an event listener attached to a form and there is logic for disabling event.submitter
:
document.querySelector('form').addEventListener('submit', e => {
e.submitter.disabled = true
})
Just tried to execute the code above and managed to reproduce the bug
Reporter | ||
Comment 5•3 years ago
|
||
(In reply to pelagusrem from comment #4)
(In reply to Jan Honza Odvarko [:Honza] (always need-info? me) from comment #3)
Thank you for the report!
I can't reproduce the issue on my machine (I am seeing payload
button="value"
).
Here is an online test case I am using
http://janodvarko.cz/tests/bugzilla/1753873/Can you please try it and let me know how it works for you?
Hani, do you know what the test is doing wrong?
It is working for me. It seems I found the issue. The button data is not sent If there is an event listener attached to a form and there is logic for disabling
event.submitter
:document.querySelector('form').addEventListener('submit', e => { e.submitter.disabled = true })
Just tried to execute the code above and managed to reproduce the bug
I mean execute in dev tools on the test form: http://janodvarko.cz/tests/bugzilla/1753873/
Comment 6•3 years ago
|
||
I created an html with the exact form from the description, on Firefox the request isn't received after pressing on submit.
Please see the screenshot attached comparing Firefox with Google Chrome.
Reporter | ||
Comment 7•3 years ago
|
||
(In reply to Hani Yacoub from comment #6)
Created attachment 9262650 [details]
Screenshot 2022-02-07 at 16.42.07.pngI created an html with the exact form from the description, on Firefox the request isn't received after pressing on submit.
Please see the screenshot attached comparing Firefox with Google Chrome.
Seems like network logs was cleared during page refresh after submittion. Try press the settings button in the dev tools on the rigth and turn on continuous log (I don't know the exact name of the setting)
Comment 8•3 years ago
|
||
Thank you for the response.
I updated my test cases (added the e.submitter.disabled = true
) and I don't see the POST data payload nor in Firefox neither in Chrome (Chrome doesn't display the "Payload" side panel at all). This seems to be correct behavior given that the submitter (button) is disabled.
Hani, please try again. You need to select the Network panel first and than press the button to see the POST request.
Honza
Reporter | ||
Comment 9•3 years ago
|
||
(In reply to Jan Honza Odvarko [:Honza] (always need-info? me) from comment #8)
Thank you for the response.
I updated my test cases (added the
e.submitter.disabled = true
) and I don't see the POST data payload nor in Firefox neither in Chrome (Chrome doesn't display the "Payload" side panel at all). This seems to be correct behavior given that the submitter (button) is disabled.Hani, please try again. You need to select the Network panel first and than press the button to see the POST request.
Honza
Safari (15.2 (17612.3.6.1.6)) does send the info
Reporter | ||
Comment 10•3 years ago
|
||
I guess this is not a bug not sending disabled button, though it may be not intuitive that disabling button inside of onsubmit handler causing not sending it's value.
Reporter | ||
Comment 11•3 years ago
|
||
Tell me, please, how can I close this bug report?
Comment 12•3 years ago
|
||
Closing (using the buttons at the bottom of this page)
Thank you for triaging this.
Honza
Updated•3 years ago
|
Description
•