# numericality

Source: https://zotonic.com/docs/1749/numericality

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

Language: en



Numerical input and range check.

Checks if the input is a number and within a certain range or equal to a fixed value. At the moment only integer inputs are allowed.

Arguments are is, minimum and maximum.

For example, when the input must be 42:

```django
<input type="text" id="number" name="number" value="" />
{% validate id="number" type={numericality is=42} %}
```

And for a number within a certain range:

```django
<input type="text" id="percent" name="percent" value="" />
{% validate id="percent" type={numericality minimum=0 maximum=100} %}
```

Arguments
---------

| Argument                 | Description                                                                      | Example                    |
| ------------------------ | -------------------------------------------------------------------------------- | -------------------------- |
| `is`                     | Tests for equality.                                                              | `is=42`                    |
| `minimum`                | Minimum value.                                                                   | `minimum=1`                |
| `maximum`                | Maximum value.                                                                   | `maximum=100`              |
| `is_float`               | Boolean flag which tells if the input can be a floating point number. Defaults to false. | `is_float` `is_float=true` |
| `not_a_number_message`   | Message to show when the entered value is not a number. Defaults to “Must be a number.” | `not_a_number_message="*"` |
| `not_an_integer_message` | Message to show when the entered number is not an integer. Defaults to “Must be an integer.” |                            |
| `wrong_number_message`   | Message to show when the entered number is unequal to the `.is.` argument. Defaults to “Must be ..” |                            |
| `too_low_message`        | Message for when the entered number is less than the minimum allowed. Defaults to “Must not be less than ..” |                            |
| `too_high_message`       | Message for when the entered number is greater than the maximum allowed. Defaults to “Must not be more than ..” |                            |

License: 

Attribution: 

Related resources: https://zotonic.com/api/agent/related/1749?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/1749?language=en>)
