HTML <button> formenctype属性
例
2つの送信ボタンがあるフォーム。最初の送信ボタンはデフォルトの文字エンコードを使用してフォームデータを送信し、2番目のボタンは文字エンコードを使用せずにフォームデータを送信します。
<form action="/action_page_binary.asp" method="post">
<label for="fname">First name:</label>
<input type="text" id="fname"
name="fname" value="Ståle"><br><br>
<button type="submit">Submit with character encoding</button>
<button type="submit" formenctype="text/plain">Submit without character encoding</button>
</form>
定義と使用法
このformenctype
属性は、フォームデータをサーバーに送信する前にエンコードする方法を指定します。この属性は、フォームの属性をオーバーライドしenctype
ます。
このformenctype
属性は、が付いたボタンにのみ使用されます
type="submit"
。
ブラウザのサポート
表の数字は、属性を完全にサポートする最初のブラウザーバージョンを示しています。
Attribute | |||||
---|---|---|---|---|---|
formenctype | 9.0 | 10.0 | 4.0 | 5.1 | 11.5 |
構文
<button type="submit" formenctype="value">
属性値
Value | Description |
---|---|
application/x-www-form-urlencoded | Default. All characters will be encoded before sent |
multipart/form-data | This value is necessary if the user will upload a file through the form |
text/plain | Sends data without any encoding at all. Not recommended |
❮HTML<button>タグ