HTMLInputElement: formMethod property
MDN Web Docs · نسخهٔ df622a2a1c1e · CC BY-SA 2.5 و مجوز جداگانهٔ ناشر برای نمونهکد
{{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 submits the form. It reflects the value of the <input>'s [formmethod](/en-US/docs/Web/HTML/Reference/Elements/input#formmethod) attribute.
This property is valid only for [submit](/en-US/docs/Web/HTML/Reference/Elements/input/submit) and [image](/en-US/docs/Web/HTML/Reference/Elements/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
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/Reference/Elements/input/submit) - [
<input type="image">](/en-US/docs/Web/HTML/Reference/Elements/input/image) - Sending form data