Skip to main content

HTML Guide

Bad value “” for attribute “name” on element “form”: Must not be empty.

An empty value for the name attribute on the form element is invalid and should be removed or replaced with a valid non-empty string.

The name attribute on a form element provides a way to reference forms via scripts and images, and it must not be empty. According to the HTML standard, if the name attribute is present, it must have a non-empty value. An empty string is considered invalid and will trigger HTML validator errors.

Invalid example:

<form name="">
  <!-- form elements here -->
</form>

How to fix:

  • Remove the empty name attribute if you don’t need it.
  • Replace the empty value with a meaningful, unique name if you require it for scripting or identification.

Valid examples:

<form>
  <!-- form elements here -->
</form>
<form name="registrationForm">
  <!-- form elements here -->
</form>

Avoid using empty attribute values, as they do not provide any benefit and result in validation errors.

Learn more:

Related W3C validator issues