Architect's Log

I'm a Cloud Architect. I'm highly motivated to reduce toils with driving DevOps.

button要素 formenctype属性

button要素のformenctype属性は、form要素のenctype属性と同じ意味をもちますが、form要素よりも優先されます。

使用例

ボタンによってフォームの送信データ形式を変えたいケースというのはどんな場合でしょうか?私には適切な使用例が思いつきませんでした。

start.html
<!DOCTYPE html>
<html lang="ja">
<head>
<title>Hello! HTML5></title>
<meta charset="UTF-8">
</head>
<body>
    <form action="./regeister.html" method="post" enctype="text/plain" id="order">
        <p>
            名前:<input type="text" id="name" />
        </p>
        <p>
        <button type="submit" formenctype="application/x-www-form-urlencoded">送信</button>
        </p>
    </form>
</body>