# Bad value X for attribute “multiple” on element “input”.

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

The `multiple` attribute tells the browser that the user can supply more than one value for a given input. For `<input type="file">`, it allows selecting multiple files at once. For `<input type="email">`, it allows entering a comma-separated list of email addresses. These are the **only two** input types that support the `multiple` attribute according to the HTML specification.

This validation error can appear for two distinct reasons, and sometimes both at once:

1. **An invalid value is assigned to the boolean attribute.** Boolean attributes in HTML follow strict rules. Valid syntaxes are: the attribute name alone (`multiple`), an empty string value (`multiple=""`), or the attribute's own name as the value (`multiple="multiple"`). Any other value — including `multiple="true"`, `multiple="1"`, or `multiple="yes"` — is invalid.

2. **The attribute is used on an unsupported input type.** Placing `multiple` on input types like `text`, `number`, `password`, or `url` is not valid because those types don't define behavior for this attribute. Browsers will simply ignore it, but it still constitutes invalid markup.

### Why this matters

- **Standards compliance:** Invalid boolean attribute values violate the [WHATWG HTML specification](https://html.spec.whatwg.org/multipage/common-microsyntax.html#boolean-attributes). While most browsers are forgiving and may still interpret `multiple="true"` as the attribute being present, relying on this behavior is fragile and non-standard.
- **Accessibility:** Assistive technologies rely on valid, well-structured markup. An invalid attribute value could lead to unpredictable behavior in screen readers or other tools.
- **Maintainability:** Using `multiple` on an unsupported input type suggests a misunderstanding of the element's capabilities, which can confuse other developers and lead to bugs.

### How to fix it

- **Remove the value entirely:** Change `multiple="1"` or `multiple="true"` to just `multiple`.
- **Use a valid boolean syntax if a value is required:** Some templating systems or XML-based contexts (like XHTML) require explicit attribute values. In those cases, use `multiple=""` or `multiple="multiple"`.
- **Ensure the input type supports `multiple`:** Only `type="email"` and `type="file"` accept this attribute. If you need multi-value input for other types, consider alternative approaches like multiple separate inputs, a `<select multiple>` element, or a JavaScript-based solution.

## Examples

### Invalid: wrong value on a boolean attribute

```html
<!-- Bad: "1" is not a valid boolean attribute value -->
<input type="file" name="attachments" multiple="1">

<!-- Bad: "true" is not a valid boolean attribute value -->
<input type="email" name="recipients" multiple="true">
```

### Invalid: `multiple` on an unsupported input type

```html
<!-- Bad: type="text" does not support the multiple attribute -->
<input type="text" name="tags" multiple>

<!-- Bad: type="number" does not support the multiple attribute -->
<input type="number" name="quantities" multiple>
```

### Valid: correct usage of `multiple`

```html
<!-- Correct: boolean attribute with no value -->
<input type="file" name="attachments" multiple>

<!-- Correct: empty string value (valid boolean syntax) -->
<input type="email" name="recipients" multiple="">

<!-- Correct: attribute name as value (valid for XHTML compatibility) -->
<input type="file" name="documents" multiple="multiple">
```

### Full corrected document

```html
<!DOCTYPE html>
<html lang="en">
<head>
  <title>Upload Form</title>
</head>
<body>
  <form action="/submit" method="post" enctype="multipart/form-data">
    <label for="recipients">Recipients:</label>
    <input type="email" id="recipients" name="recipients" multiple placeholder="a@example.com, b@example.com">

    <label for="files">Attachments:</label>
    <input type="file" id="files" name="files" multiple>

    <button type="submit">Send</button>
  </form>
</body>
</html>
```
