Closed Bug 1753873 Opened 3 years ago Closed 3 years ago

<button /> attribute "name" does not sent along with a <form /> submit request

Categories

(DevTools :: Netmonitor, defect)

Firefox 97
Desktop
All
defect

Tracking

(firefox-esr91 wontfix, firefox96 wontfix, firefox97 wontfix, firefox98 wontfix)

RESOLVED INVALID
Tracking Status
firefox-esr91 --- wontfix
firefox96 --- wontfix
firefox97 --- wontfix
firefox98 --- wontfix

People

(Reporter: pelagusrem, Unassigned)

Details

Attachments

(1 file)

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"

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.

Component: Untriaged → Netmonitor
Product: Firefox → DevTools
Component: Netmonitor → General
OS: Unspecified → macOS
Product: DevTools → Firefox
Hardware: Unspecified → Desktop

Managed to reproduce this on Windows 10 x64, macOS 11.6 and on Ubuntu 20.04 x64.

Severity: -- → S4
Status: UNCONFIRMED → NEW
Component: General → Netmonitor
Ever confirmed: true
OS: macOS → All
Product: Firefox → DevTools

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?

Flags: needinfo?(pelagusrem)

(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

Flags: needinfo?(pelagusrem)

(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/

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.

(In reply to Hani Yacoub from comment #6)

Created attachment 9262650 [details]
Screenshot 2022-02-07 at 16.42.07.png

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.

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)

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

(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

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.

Tell me, please, how can I close this bug report?

Closing (using the buttons at the bottom of this page)

Thank you for triaging this.

Honza

Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: