button formenctype Attribute - HTML CSS HTML Tag

HTML CSS examples for HTML Tag:button

Description

The formenctype attribute sets how form-data should be encoded before sending it to a server. This attribute overrides the form's enctype attribute.

The formenctype attribute is only used for buttons with type="submit".

Attribute Values

Value Description
application/x-www-form-urlencoded Default. All characters will be encoded before sent
multipart/form-data No characters are encoded (for file upload control)
text/plainSpaces are converted to "+" symbols, but no characters are encoded

A form with two submit buttons. The first submit button submits the form data with default character encoding, and the second submits the form data without character encoding:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<form action="/action_page_binary.asp" method="post">
  Name: <input type="text" name="fname" value="St?le Refsnes"><br>
  <button type="submit">Submit with character encoding</button>
  <button type="submit" formenctype="text/plain">Submit without character encoding</button>
</form><!--from w w  w .  ja  v a  2 s  . c om-->

</body>
</html>

Related Tutorials