# length

Source: https://zotonic.com/docs/1730/length

URI: https://zotonic.com/id/1730

Language: en



Check the length of a text input.

Test if the length of the input’s value is more than a minimum and/or less than a maximum length.

Arguments are minimum and maximum. You can give either or both arguments.

For example, a summary that is neither too long nor too short:

```django
<textarea id="summary" name="summary"></textarea>
{% validate id="summary" type={length minimum=20 maximum=200} %}
```

Arguments
---------

| Argument               | Description                                                                      | Example      |
| ---------------------- | -------------------------------------------------------------------------------- | ------------ |
| `is`                   | Use when the value must be a specific length.                                    | `is=4`       |
| `minimum`              | The minimum length of the value.                                                 | `minimum=4`  |
| `maximum`              | The maximum length of the value.                                                 | `maximum=10` |
| `wrong_length_message` | Message for when the length is unequal to the value of the “is” argument. Defaults to “Must be . characters long.” |              |
| `too_short_message`    | Message for when there are not enough characters entered. Defaults to “Must not be less than . characters long.” |              |
| `too_long_message`     | Message for when there are too many characters entered. Defaults to “Must not be more than . characters long.” |              |

License: 

Attribution: 

Related resources: https://zotonic.com/api/agent/related/1730?language=en


## API access

- [API help](<https://zotonic.com/api-help>)
- [OpenAPI specification](<https://zotonic.com/openapi.json>)
- [This resource as JSON](<https://zotonic.com/api/agent/resource/1730?language=en>)
