Skip to content

Commit

Permalink
New pages: HTML<form>FormMethod (#36273)
Browse files Browse the repository at this point in the history
* New pages: HTML<form>FormMethod

* input submission

* New pages: HTML<form>FormMethod
  • Loading branch information
estelle authored Oct 12, 2024
1 parent 99eff5c commit 8bbefa7
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 0 deletions.
40 changes: 40 additions & 0 deletions files/en-us/web/api/htmlbuttonelement/formmethod/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
title: "HTMLButtonElement: formMethod property"
short-title: formMethod
slug: Web/API/HTMLButtonElement/formMethod
page-type: web-api-instance-property
browser-compat: api.HTMLButtonElement.formMethod
---

{{APIRef("HTML DOM")}}

The **`formMethod`** property of the {{domxref("HTMLButtonElement")}} interface is the {{Glossary("HTTP")}} method used to submit the {{HtmlElement("form")}} if the {{HTMLElement("button")}} element is the control that submits the form. It reflects the value of the `<button>`'s [`formmethod`](/en-US/docs/Web/HTML/Element/button#formmethod) attribute.

The value overrides the {{domxref("HTMLFormElement.method", "method")}} property of the {{domxref("HTMLFormElement")}} interface if the form is submitted via the button. This property can be retrieved or set. If set with an empty or invalid value, the invalid default value is `"get"`. If not set at all, the value is the empty string (`""`).

## Value

A string; `"post"`, `"get"`, `"dialog"`, or `""`.

## Examples

```js
btnEl.formMethod = "post";
```

## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}

## See also

- {{domxref("HTMLButtonElement.formAction")}}
- {{domxref("HTMLButtonElement.formEnctype")}}
- {{domxref("HTMLButtonElement.formNoValidate")}}
- {{domxref("HTMLButtonElement.formTarget")}}
- {{domxref("HTMLFormElement.method")}}
- [Sending form data](/en-US/docs/Learn/Forms/Sending_and_retrieving_form_data)
44 changes: 44 additions & 0 deletions files/en-us/web/api/htmlinputelement/formmethod/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
title: "HTMLInputElement: formMethod property"
short-title: formMethod
slug: Web/API/HTMLInputElement/formMethod
page-type: web-api-instance-property
browser-compat: api.HTMLInputElement.formMethod
---

{{APIRef("HTML DOM")}}

The **`formMethod`** property of the {{domxref("HTMLInputElement")}} interface is the {{Glossary("HTTP")}} method used to submit the {{HtmlElement("form")}} if the {{HTMLElement("input")}} element is the control that sumbits the form. It reflects the value of the `<input>`'s [`formmethod`](/en-US/docs/Web/HTML/Element/input#formmethod) attribute.

This property is valid only for [`submit`](/en-US/docs/Web/HTML/Element/input/submit) and [`image`](/en-US/docs/Web/HTML/Element/input/image) `<input>` elements.

The value overrides the {{domxref("HTMLFormElement.method", "method")}} property of the {{domxref("HTMLFormElement")}} interface if the form is submitted via the input. This property can be retrieved or set. If set with an empty or invalid value, the invalid default value is `"get"`. If not set at all, the value is the empty string (`""`).

## Value

A string; `"post"`, `"get"`, `"dialog"`, or `""`.

## Examples

```js
inputElement.formMethod = "post";
```

## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}

## See also

- {{domxref("HTMLInputElement.formAction")}}
- {{domxref("HTMLInputElement.formEnctype")}}
- {{domxref("HTMLInputElement.formNoValidate")}}
- {{domxref("HTMLInputElement.formTarget")}}
- {{domxref("HTMLFormElement.method")}}
- [`<input type="submit">`](/en-US/docs/Web/HTML/Element/input/submit)
- [`<input type="image">`](/en-US/docs/Web/HTML/Element/input/image)
- [Sending form data](/en-US/docs/Learn/Forms/Sending_and_retrieving_form_data)

0 comments on commit 8bbefa7

Please sign in to comment.