# Saw a “form” start tag, but there was already an active “form” element. Nested forms are not allowed. Ignoring the tag.

> Canonical HTML version: https://rocketvalidator.com/html-validation/saw-a-form-start-tag-but-there-was-already-an-active-form-element-nested-forms-are-not-allowed-ignoring-the-tag
> Attribution: Rocket Validator (https://rocketvalidator.com)
> License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

A `<form>` can't contain another `<form>`, so when the parser finds a second `<form>` start tag while one is still open, it drops that tag along with its `action`, `method` and `id`.

The fields inside the ignored form then belong to the outer one. In the invalid example below, the "Delete account" button submits the account form to `/account`, and nothing is ever sent to `/account/delete`. The inner `</form>` also closes the outer form early, so any fields after it end up outside any form, and the validator reports the last `</form>` as `Stray end tag “form”`.

A common cause is a page template that wraps the whole page in one form, with a search box or newsletter signup inside it that adds a form of its own. A missing `</form>` causes it too. If the parent element of the first form closes before the form does, the parser still treats that form as active, and it ignores the next `<form>` on the page.

Move the inner form out so the two forms are siblings. When a button or field has to stay inside one form's layout but submit a different form, give that form an `id` and point the control at it with the `form` attribute: `<button type="submit" form="delete-account">`. The `<button>`, `<input>`, `<select>` and `<textarea>` elements all accept `form`. The form it points to can sit anywhere in the document, and it can be empty, as in the valid example below.

## Invalid example

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

  <form action="/account/delete" method="post">
    <button type="submit">Delete account</button>
  </form>
</form>
```

## Valid example

```html
<form action="/account" method="post">
  <label for="email">Email</label>
  <input type="email" id="email" name="email">
  <button type="submit">Save</button>
  <button type="submit" form="delete-account">Delete account</button>
</form>

<form id="delete-account" action="/account/delete" method="post"></form>
```
