# Bad value X for attribute “value” on element “input”: Line feed not allowed.

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

A single-line `<input>`, such as `type="text"`, can't hold a line break in its `value`, so the text has to fit on one line or move to a `<textarea>`.

The HTML standard says the `value` of text, search, telephone and password inputs must not contain line feed or carriage return characters. Browsers enforce this by stripping them: an input whose `value` is `12 Main Street`, a line break and `Springfield` shows `12 Main StreetSpringfield`, with the two lines glued together. Writing the line break as `&#10;` doesn't help, because the validator and the browser both see the decoded character.

This usually happens when a template prints text from a database or a rich text editor straight into `value`, and that text was saved with line breaks. When Nu shortens a long value, the message reads `Bad value  for attribute`, with no value between the two spaces; look for an `<input>` whose `value` spans several lines in the source.

Pick the fix that matches what the field is for:

- If people should see and edit several lines, use a `<textarea>`, which keeps line breaks.
- If the field is meant to be single-line, replace the line breaks with a space or a comma before printing the value.
- If the input only carries data for a script and nobody edits it, `type="hidden"` accepts line breaks in its `value`.

## Invalid example

```html
<label for="address">Address</label>
<input type="text" id="address" name="address" value="12 Main Street
Springfield">
```

## Valid example

```html
<label for="address">Address</label>
<input type="text" id="address" name="address" value="12 Main Street, Springfield">
```

### Keeping the line break with a textarea

```html
<label for="address">Address</label>
<textarea id="address" name="address" rows="2">12 Main Street
Springfield</textarea>
```
