1

Whenever I click the submit button (save button here), the form sends a post request, but there is no data in the form, which it should be.

The form actually has 3 inputs: the text input, the file input, and the submit input. I'm using a flask backend and when i print out request.form and request.files, nothing is showing in the dictionary.

<form action="" id="realForm1" method="POST" enctype="multipart/form-data">
  <input type="text" form="realForm1" class="form-control col-8 col-md-6" id="createANameInput" style="border-radius: 0;">
  <input type="file" id="realInput" form="realForm1">
  <input type="submit" id="hiddenButton">
</form>

I expect to see the data show up when I print out request.form or request.files, but it's not showing up at all!

Nick Parsons
  • 45,728
  • 6
  • 46
  • 64
Nate Baker
  • 11
  • 3

1 Answers1

1

As per W3C Specification:

Every successful control/field has its control name paired with its current value as part of the submitted form data set. A successful control must be defined within a FORM element and must have a control name.

The algorithm to construct the form data set for a form is mentioned in this W3C Specification.

Only the fields that have name attribute are submitted.

  • Here is a similar question:

Does form data still transfer if the input tag has no name?

  • Further Reading

Disabled form inputs do not appear in the request

talha2k
  • 24,937
  • 4
  • 62
  • 81