# To set the document’s location as the action for a form, omit the “action” attribute.

> Canonical HTML version: https://rocketvalidator.com/html-validation/to-set-the-documents-location-as-the-action-for-a-form-omit-the-action-attribute
> Attribution: Rocket Validator (https://rocketvalidator.com)
> License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

An empty `action` attribute on a `<form>` element is not valid HTML. To submit a form to the current page URL, remove the `action` attribute entirely.

When a `<form>` has no `action` attribute, the browser submits the form data to the URL of the current document. This is the same behavior most developers expect from `action=""`, but the empty string is not a valid URL according to the HTML specification. The W3C validator flags this because the `action` attribute, when present, must contain a valid non-empty URL.

Removing the attribute is the correct fix. The HTML living standard explicitly states that omitting `action` causes the form to submit to the document's own URL.

## HTML examples

### Invalid empty action

```html
<form action="" method="post">
  <label for="email">Email</label>
  <input type="email" id="email" name="email">
  <button type="submit">Subscribe</button>
</form>
```

### Fixed by removing the action attribute

```html
<form method="post">
  <label for="email">Email</label>
  <input type="email" id="email" name="email">
  <button type="submit">Subscribe</button>
</form>
```
