HTML and button and formenctype properties

HTML button for menctype property HTML slt;button-and-label

If you use the formenctype property when you use the label, its value overrides the enctype property value of the label:

Forms with two submit buttons (with different encoding methods), the first submit button uses the default character encoding to submit form data, and the second submit button does not use character encoding to submit form data:

<form action="demo_post_enctype.asp" method="post">
Name: <input type="text" name="fname" value="Ståle Refsnes"><br>
<button type="submit" >使用编码提交</button>
<button type="submit" formenctype="text/plain">不使用编码提交</button>
</form>

Try it out . . .

Browser support

HTML button for menctype property HTML button for menctype property HTML button for menctype property HTML button for menctype property HTML button for menctype property

Internet Explorer 10, Firefox, Opera, Chrome, and Safari support formenctype properties.

Note: Internet Explorer 9 and earlier versions of IE do not support formenctype properties.


Definitions and usages

The formenctype property overrides the enctype property of the form element.

This property is used in conjunction with type "submit".


The difference between HTML 4.01 and HTML 5

The formenctype property is a new property in HTML 5.


Grammar

<button type="submit" formenctype="value">

The property value

Value Describe
application/x-www-form-urlencoded Encode all characters before sending (default).
multipart/form-data Character encoding is not allowed. This value is required when using a form with a file upload control.
text/plain Converts a space to a "plus" symbol, but does not encode special characters.


HTML button for menctype property HTML slt;button-and-label