---
title: "ValidityState | JavaScript maps SDK"
description: "Documentation for MapTiler SDK"
---

> For AI agents: a documentation index is available at [/llms.txt](https://docs.maptiler.com/llms.txt). Markdown versions of all pages are available by appending .md to any URL.

# Interface ValidityState

The **`ValidityState`** interface represents the validity states that an element can be in, with respect to constraint validation. Together, they help explain why an element's value fails to validate, if it's not valid.

[MDN Reference](https://developer.mozilla.org/docs/Web/API/ValidityState)

interface ValidityState {  
    [badInput](#badinput): boolean;  
    [customError](#customerror): boolean;  
    [patternMismatch](#patternmismatch): boolean;  
    [rangeOverflow](#rangeoverflow): boolean;  
    [rangeUnderflow](#rangeunderflow): boolean;  
    [stepMismatch](#stepmismatch): boolean;  
    [tooLong](#toolong): boolean;  
    [tooShort](#tooshort): boolean;  
    [typeMismatch](#typemismatch): boolean;  
    [valid](#valid): boolean;  
    [valueMissing](#valuemissing): boolean;  
}

##### Index

### Properties[](#properties)

[badInput](#badinput) [customError](#customerror) [patternMismatch](#patternmismatch) [rangeOverflow](#rangeoverflow) [rangeUnderflow](#rangeunderflow) [stepMismatch](#stepmismatch) [tooLong](#toolong) [tooShort](#tooshort) [typeMismatch](#typemismatch) [valid](#valid) [valueMissing](#valuemissing)

## Properties[](#properties-1)

### `Readonly`badInput[](#badinput)

badInput: boolean

The read-only **`badInput`** property of the ValidityState interface indicates if the user has provided input that the browser is unable to convert. For example, if you have a number input element whose content is a string.

[MDN Reference](https://developer.mozilla.org/docs/Web/API/ValidityState/badInput)

### `Readonly`customError[](#customerror)

customError: boolean

The read-only **`customError`** property of the ValidityState interface returns true if an element doesn't meet the validation required in the custom validity set by the element's setCustomValidity() method.

[MDN Reference](https://developer.mozilla.org/docs/Web/API/ValidityState/customError)

### `Readonly`patternMismatch[](#patternmismatch)

patternMismatch: boolean

The read-only **`patternMismatch`** property of the ValidityState interface indicates if the value of an , after having been edited by the user, does not conform to the constraints set by the element's pattern attribute.

[MDN Reference](https://developer.mozilla.org/docs/Web/API/ValidityState/patternMismatch)

### `Readonly`rangeOverflow[](#rangeoverflow)

rangeOverflow: boolean

The read-only **`rangeOverflow`** property of the ValidityState interface indicates if the value of an , after having been edited by the user, does not conform to the constraints set by the element's max attribute.

[MDN Reference](https://developer.mozilla.org/docs/Web/API/ValidityState/rangeOverflow)

### `Readonly`rangeUnderflow[](#rangeunderflow)

rangeUnderflow: boolean

The read-only **`rangeUnderflow`** property of the ValidityState interface indicates if the value of an , after having been edited by the user, does not conform to the constraints set by the element's min attribute.

[MDN Reference](https://developer.mozilla.org/docs/Web/API/ValidityState/rangeUnderflow)

### `Readonly`stepMismatch[](#stepmismatch)

stepMismatch: boolean

The read-only **`stepMismatch`** property of the ValidityState interface indicates if the value of an , after having been edited by the user, does not conform to the constraints set by the element's step attribute.

[MDN Reference](https://developer.mozilla.org/docs/Web/API/ValidityState/stepMismatch)

### `Readonly`tooLong[](#toolong)

tooLong: boolean

The read-only **`tooLong`** property of the ValidityState interface indicates if the value of an  or , after having been edited by the user, exceeds the maximum code-unit length established by the element's maxlength attribute.</p> <p><a href="https://developer.mozilla.org/docs/Web/API/ValidityState/tooLong">MDN Reference</a></p> </div></section> <section class="tsd-panel tsd-member tsd-is-external"> <h3 class="tsd-anchor-link" id="tooshort"><code class="tsd-tag tsd-tag-readonly">Readonly</code><span>too<wbr/>Short</span><a href="#tooshort" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3> <div class="tsd-signature"><span class="tsd-kind-property">tooShort</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div> <div class="tsd-comment tsd-typography"><p>The read-only <strong><code>tooShort</code></strong> property of the ValidityState interface indicates if the value of an <input>, <button>, <select>, <output>, <fieldset> or <textarea>, after having been edited by the user, is less than the minimum code-unit length established by the element's minlength attribute.</p> <p><a href="https://developer.mozilla.org/docs/Web/API/ValidityState/tooShort">MDN Reference</a></p> </div></section> <section class="tsd-panel tsd-member tsd-is-external"> <h3 class="tsd-anchor-link" id="typemismatch"><code class="tsd-tag tsd-tag-readonly">Readonly</code><span>type<wbr/>Mismatch</span><a href="#typemismatch" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3> <div class="tsd-signature"><span class="tsd-kind-property">typeMismatch</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div> <div class="tsd-comment tsd-typography"><p>The read-only <strong><code>typeMismatch</code></strong> property of the ValidityState interface indicates if the value of an <input>, after having been edited by the user, does not conform to the constraints set by the element's type attribute.</p> <p><a href="https://developer.mozilla.org/docs/Web/API/ValidityState/typeMismatch">MDN Reference</a></p> </div></section> <section class="tsd-panel tsd-member tsd-is-external"> <h3 class="tsd-anchor-link" id="valid"><code class="tsd-tag tsd-tag-readonly">Readonly</code><span>valid</span><a href="#valid" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3> <div class="tsd-signature"><span class="tsd-kind-property">valid</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div> <div class="tsd-comment tsd-typography"><p>The read-only <strong><code>valid</code></strong> property of the ValidityState interface indicates if the value of an <input> element meets all its validation constraints, and is therefore considered to be valid.</p> <p><a href="https://developer.mozilla.org/docs/Web/API/ValidityState/valid">MDN Reference</a></p> </div></section> <section class="tsd-panel tsd-member tsd-is-external"> <h3 class="tsd-anchor-link" id="valuemissing"><code class="tsd-tag tsd-tag-readonly">Readonly</code><span>value<wbr/>Missing</span><a href="#valuemissing" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3> <div class="tsd-signature"><span class="tsd-kind-property">valueMissing</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div> <div class="tsd-comment tsd-typography"><p>The read-only <strong><code>valueMissing</code></strong> property of the ValidityState interface indicates if a required control, such as an <input>, <select>, or <textarea>, has an empty value.</p> <p><a href="https://developer.mozilla.org/docs/Web/API/ValidityState/valueMissing">MDN Reference</a></p> </div></section></section></details></div> <div class="col-sidebar"> <div class="page-menu"> <div class="tsd-navigation settings"> <details class="tsd-accordion"><summary class="tsd-accordion-summary"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> <h3>Settings</h3></summary> <div class="tsd-accordion-details"> <div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span> <ul id="tsd-filter-options"> <li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li> <li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div> <div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div> <details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> <h3>On This Page</h3></summary> <div class="tsd-accordion-details"> <details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Properties"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Properties</summary> <div><a href="#badinput" class="tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>bad<wbr/>Input</span></a><a href="#customerror" class="tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>custom<wbr/>Error</span></a><a href="#patternmismatch" class="tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>pattern<wbr/>Mismatch</span></a><a href="#rangeoverflow" class="tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>range<wbr/>Overflow</span></a><a href="#rangeunderflow" class="tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>range<wbr/>Underflow</span></a><a href="#stepmismatch" class="tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>step<wbr/>Mismatch</span></a><a href="#toolong" class="tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>too<wbr/>Long</span></a><a href="#tooshort" class="tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>too<wbr/>Short</span></a><a href="#typemismatch" class="tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>type<wbr/>Mismatch</span></a><a href="#valid" class="tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>valid</span></a><a href="#valuemissing" class="tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>value<wbr/>Missing</span></a></div></details></div></details></div> <div class="site-menu"> <nav class="tsd-navigation"><a href="../modules.html">MapTiler SDK - v4.2.0</a> <ul class="tsd-small-nested-navigation" id="tsd-nav-container"> <li>Loading...</li></ul></nav></div></div></div><footer></footer> <div class="overlay"></div></body></html>
