Skip to content

Commit c4d3346

Browse files
committed
Add PUT, PATCH, and DELETE to form method attribute
1 parent fd08f81 commit c4d3346

File tree

1 file changed

+67
-3
lines changed

1 file changed

+67
-3
lines changed

source

Lines changed: 67 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57151,6 +57151,21 @@ form.method === input; // => true</code></pre>
5715157151
data-x="attr-fs-method-POST-keyword">post</code></dfn>
5715257152
<td><dfn data-x="attr-fs-method-POST">POST</dfn>
5715357153
<td>Indicates the <code>form</code> will use the HTTP POST method.
57154+
<tr>
57155+
<td><dfn attr-value for="form/method,button/formmethod,input/formmethod"><code
57156+
data-x="attr-fs-method-PUT-keyword">put</code></dfn>
57157+
<td><dfn data-x="attr-fs-method-PUT">PUT</dfn>
57158+
<td>Indicates the <code>form</code> will use the HTTP PUT method.
57159+
<tr>
57160+
<td><dfn attr-value for="form/method,button/formmethod,input/formmethod"><code
57161+
data-x="attr-fs-method-PATCH-keyword">patch</code></dfn>
57162+
<td><dfn data-x="attr-fs-method-PATCH">PATCH</dfn>
57163+
<td>Indicates the <code>form</code> will use the HTTP PATCH method.
57164+
<tr>
57165+
<td><dfn attr-value for="form/method,button/formmethod,input/formmethod"><code
57166+
data-x="attr-fs-method-DELETE-keyword">delete</code></dfn>
57167+
<td><dfn data-x="attr-fs-method-DELETE">DELETE</dfn>
57168+
<td>Indicates the <code>form</code> will use the HTTP DELETE method.
5715457169
<tr>
5715557170
<td><dfn attr-value for="form/method,button/formmethod,input/formmethod"><code
5715657171
data-x="attr-fs-method-dialog-keyword">dialog</code></dfn>
@@ -57184,13 +57199,26 @@ form.method === input; // => true</code></pre>
5718457199
&lt;p>&lt;input type=submit>&lt;/p>
5718557200
&lt;/form></code></pre>
5718657201

57202+
</div>
57203+
57204+
<div class="example">
57205+
57206+
<p>The <code data-x="attr-fs-method">method</code> attribute can also specify the value
57207+
"<code data-x="attr-fs-method-DELETE-keyword">delete</code>", which has also sends the form's
57208+
values as query parameters, this time with the HTTP DELETE method:
57209+
57210+
<pre><code class="html">&lt;form method="delete" action="/delete-user.cgi">
57211+
&lt;p>&lt;label>User ID: &lt;input type=text name=id>&lt;/label>&lt;/p>
57212+
&lt;p>&lt;input type=submit>&lt;/p>
57213+
&lt;/form></code></pre>
57214+
5718757215
</div>
5718857216

5718957217
<div class="example">
5719057218

5719157219
<p>On the other hand, here the <code data-x="attr-fs-method">method</code> attribute is used to
5719257220
specify the value "<code data-x="attr-fs-method-POST-keyword">post</code>", so that the user's
57193-
message is submitted in the HTTP request's body:</p>
57221+
message is submitted in the HTTP request's body, with the POST method:</p>
5719457222

5719557223
<pre><code class="html">&lt;form method="post" action="/post-message.cgi">
5719657224
&lt;p>&lt;label>Message: &lt;input type=text name=m>&lt;/label>&lt;/p>
@@ -57199,6 +57227,20 @@ form.method === input; // => true</code></pre>
5719957227

5720057228
</div>
5720157229

57230+
<div class="example">
57231+
57232+
<p>The <code data-x="attr-fs-method">method</code> attribute also supports the
57233+
"<code data-x="attr-fs-method-PUT-keyword">put</code>" and
57234+
"<code data-x="attr-fs-method-PATCH-keyword">patch</code>" keywords, which likewise submit the
57235+
form's data as part of the request body, with the respective HTTP method:
57236+
57237+
<pre><code class="html">&lt;form method="put" action="/message/123.cgi">
57238+
&lt;p>&lt;label>Message: &lt;input type=text name=m>&lt;/label>&lt;/p>
57239+
&lt;p>&lt;input type=submit value="Save edited message">&lt;/p>
57240+
&lt;/form></code></pre>
57241+
57242+
</div>
57243+
5720257244
<div class="example">
5720357245

5720457246
<p>In this example, a <code>form</code> is used with a <code>dialog</code>. The <code
@@ -60492,31 +60534,52 @@ fur
6049260534
<td>
6049360535
<th> <span data-x="attr-fs-method-GET">GET</span>
6049460536
<th> <span data-x="attr-fs-method-POST">POST</span>
60537+
<th> <span data-x="attr-fs-method-POST">PUT</span>
60538+
<th> <span data-x="attr-fs-method-POST">PATCH</span>
60539+
<th> <span data-x="attr-fs-method-POST">DELETE</span>
6049560540
<tbody>
6049660541
<tr>
6049760542
<th> <code data-x="">http</code>
6049860543
<td> <span data-x="submit-mutate-action">Mutate action URL</span>
6049960544
<td> <span data-x="submit-body">Submit as entity body</span>
60545+
<td> <span data-x="submit-body">Submit as entity body</span>
60546+
<td> <span data-x="submit-body">Submit as entity body</span>
60547+
<td> <span data-x="submit-mutate-action">Mutate action URL</span>
6050060548
<tr>
6050160549
<th> <code data-x="">https</code>
6050260550
<td> <span data-x="submit-mutate-action">Mutate action URL</span>
6050360551
<td> <span data-x="submit-body">Submit as entity body</span>
60552+
<td> <span data-x="submit-body">Submit as entity body</span>
60553+
<td> <span data-x="submit-body">Submit as entity body</span>
60554+
<td> <span data-x="submit-mutate-action">Mutate action URL</span>
6050460555
<tr>
6050560556
<th> <code data-x="">ftp</code>
6050660557
<td> <span data-x="submit-get-action">Get action URL</span>
6050760558
<td> <span data-x="submit-get-action">Get action URL</span>
60559+
<td> <span data-x="submit-get-action">Get action URL</span>
60560+
<td> <span data-x="submit-get-action">Get action URL</span>
60561+
<td> <span data-x="submit-get-action">Get action URL</span>
6050860562
<tr>
6050960563
<th> <code data-x="">javascript</code>
6051060564
<td> <span data-x="submit-get-action">Get action URL</span>
6051160565
<td> <span data-x="submit-get-action">Get action URL</span>
60566+
<td> <span data-x="submit-get-action">Get action URL</span>
60567+
<td> <span data-x="submit-get-action">Get action URL</span>
60568+
<td> <span data-x="submit-get-action">Get action URL</span>
6051260569
<tr>
6051360570
<th> <code data-x="">data</code>
6051460571
<td> <span data-x="submit-mutate-action">Mutate action URL</span>
6051560572
<td> <span data-x="submit-get-action">Get action URL</span>
60573+
<td> <span data-x="submit-get-action">Get action URL</span>
60574+
<td> <span data-x="submit-get-action">Get action URL</span>
60575+
<td> <span data-x="submit-get-action">Mutate action URL</span>
6051660576
<tr>
6051760577
<th> <code data-x="">mailto</code>
6051860578
<td> <span data-x="submit-mailto-headers">Mail with headers</span>
6051960579
<td> <span data-x="submit-mailto-body">Mail as body</span>
60580+
<td> <span data-x="submit-mailto-body">Mail as body</span>
60581+
<td> <span data-x="submit-mailto-body">Mail as body</span>
60582+
<td> <span data-x="submit-mailto-headers">Mail with headers</span>
6052060583
</table>
6052160584

6052260585
<p>If <var>scheme</var> is not one of those listed in this table, then the behavior is
@@ -60584,8 +60647,9 @@ fur
6058460647

6058560648
<dt><dfn data-x="submit-body">Submit as entity body</dfn>
6058660649
<dd>
60587-
<p><span>Assert</span>: <var>method</var> is <span
60588-
data-x="attr-fs-method-post">POST</span>.</p>
60650+
<p><span>Assert</span>: <var>method</var> is <span data-x="attr-fs-method-post">POST</span>,
60651+
<span data-x="attr-fs-method-PUT">PUT</span>, or
60652+
<span data-x="attr-fs-method-PATCH">PATCH</span>.</p>
6058960653

6059060654
<p>Switch on <var>enctype</var>:
6059160655

0 commit comments

Comments
 (0)