-
Notifications
You must be signed in to change notification settings - Fork 171
POST request from form submission missing certain input types #199
Comments
Hey, @SpencerWoo. Thx for reporting. We are going to take a look it. 😃 |
Hey @SpencerWoo, we are using HTML5 FormData to create the body of the request. I haven't tested it yet, but what you describe suggests Chrome doesn't put the value of a submit button into the FormData. Gladly, the API allows us to add more values by calling Thx for reporting this. |
Thanks all for looking at this. As a note, I believe with a standard form (or when the form has "data-senna-off") the post request does contain the clicked submit button values. Thanks again for all the responses! |
Hi all, Any updates on this issue? |
Hey @SpencerWoo, I'll tackle this issue next. I'll let you know how it goes. Thx |
Thanks @brunobasto ! edit : oops wrong button -- let me know if you have any questions! |
@SpencerWoo, here's an initial draft: #202 |
From the spec, I'm not sure if other kinds of buttons should go into the form data as well. Do you have any pointers on how the spec defines this behavior? |
Ok, so I think my PR is not accurate. The spec says:
So, I'll need to update my code. |
Awesome thanks @brunobasto -- yeah as mentioned about the submit button, but from what I can tell everything else works properly (sends data as it does without senna.js). This LPS (https://issues.liferay.com/browse/LPS-69556) mentions button, but I haven't verified. |
Another piece of reference here: https://html.spec.whatwg.org/multipage/forms.html#constructing-the-form-data-set
|
@SpencerWoo, do you happen to know what would be the expected behavior if an user submits the form using the enter key on a field inside the form? Would the value of the submit button go to the server as well? If there are more than one submit button, which one should go to the server? |
@brunobasto I found this link (http://stackoverflow.com/questions/925334/how-is-the-default-submit-button-on-an-html-form-determined) which is basically saying there's no defined spec for submitting a form with the enter key and the browser chooses which submit button is the default (the triggering one). On chrome it appears to be the first submit button. |
From what I have tested that commit looks good! Currently watching #203. |
Hey @SpencerWoo, @brunobasto, I think this is actually properly explained in the Forms HTML5 Spec, specially in the Implicit submission section.
|
Awesome, then my fix proposal already accounts for that. |
Nothing### my |
Expected behaviour
There are various types, but specifically input type="submit" should pass its name/values when it is triggering the post action as per https://www.w3.org/TR/html401/interact/forms.html#successful-controls.
Actual behaviour
When submitting the form with the input type="submit", the request does not have the input's values.
Steps to reproduce
We'll modify an existing working example to reproduce issue.
Browsers affected
I tested on Chrome, but I don't think its browser or multipart/form-data specific.
The text was updated successfully, but these errors were encountered: