# Bad value X for attribute “method” on element “form”.

> Canonical HTML version: https://rocketvalidator.com/html-validation/bad-value-x-for-attribute-method-on-element-form
> Attribution: Rocket Validator (https://rocketvalidator.com)
> License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

The `method` attribute on `<form>` accepts only `get`, `post` or `dialog`, so an empty value or an HTTP verb like `PUT` or `DELETE` is invalid.

The keywords are case-insensitive, so `POST` and `post` both work, but the value must match one of the three exactly. Extra whitespace, as in `method=" post"`, also triggers this error. `dialog` only makes sense for a form inside a `<dialog>` element, where submitting closes the dialog instead of sending a request.

Browsers fall back to GET when the value is invalid. An empty `method=""` often comes from a template that prints an unset variable. The form still submits as GET, so remove the attribute or write `method="get"`. An unsupported verb causes a real bug: a form with `method="PUT"` or `method="DELETE"` sends a GET request with the field values in the URL, so the server's PUT or DELETE handler never runs.

HTML forms can't send `PUT`, `PATCH` or `DELETE` requests. Use `method="post"` and tell the server which verb you meant. Frameworks such as Rails, Laravel and Phoenix read a hidden `_method` field for this, or you can send the request with `fetch()` from JavaScript.

## Empty value

### Invalid example

```html
<form action="/search" method="">
  <label for="q">Search</label>
  <input id="q" name="q" type="search">
  <button>Search</button>
</form>
```

### Valid example

```html
<form action="/search" method="get">
  <label for="q">Search</label>
  <input id="q" name="q" type="search">
  <button>Search</button>
</form>
```

## Unsupported HTTP verb

### Invalid example

```html
<form action="/profile" method="PUT">
  <label for="name">Name</label>
  <input id="name" name="name">
  <button>Save</button>
</form>
```

### Valid example

```html
<form action="/profile" method="post">
  <input type="hidden" name="_method" value="put">
  <label for="name">Name</label>
  <input id="name" name="name">
  <button>Save</button>
</form>
```
