HTML <button> Tag with the 'formenctype' Attribute

<form>
<!-- ...form contents... -->

<button type="submit" formaction="https://www.PuStudy.Com/resources/html-forms-action.html" formenctype="application/x-www-form-urlencoded">
Submit
</button>

</form>

In the above example we add the formenctype attribute to a button control.

About the formenctype Attribute

The formenctype attribute allows you to specify the content type used to encode the form data set when it's submitted to the server.

Possible values:

  • application/x-www-form-urlencoded (default)
  • multipart/form-data (use this when uploading files)
  • text/plain (use this when uploading files)

The W3C says:

If the element is a submit button and has a formenctype attribute, then the element's enctype is that attribute's state; otherwise, it is the form owner's enctype attribute's state.

About the <button> Element

The <button> element creates a button control in an HTML document.

Any contents of the <button> element appears on the button.

The <button> element can be associated with a form or stand alone by itself (in such case it could have JavaScript attached via the onclick attribute) to make the button actually do something.