---
title: TextValidator
product: Form Library
api-type: class
description: A class that implements a validator for text values.
source: https://surveyjs.io/form-library/documentation/api-reference/textvalidator
---

# `TextValidator`

A class that implements a validator for text values.

[View Demo](https://surveyjs.io/form-library/examples/javascript-form-validation/ (linkStyle))

## Inheritance

[`Base`](https://surveyjs.io/form-library/documentation/api-reference/base.md) &rarr; [`SurveyValidator`](https://surveyjs.io/form-library/documentation/api-reference/surveyvalidator.md) &rarr; `TextValidator`

## Properties

### `allowDigits`

**Type**: `boolean`

Specifies whether a text value can include numerical digits.

Default value: `true`

### `maxLength`

**Type**: `number`

The maximum length of a text value measured in characters.

Default value: 0 (unlimited)

[View Demo](https://surveyjs.io/form-library/examples/javascript-form-validation/ (linkStyle))

### `minLength`

**Type**: `number`

The minimum length of a text value measured in characters.

Default value: 0

[View Demo](https://surveyjs.io/form-library/examples/javascript-form-validation/ (linkStyle))
