# Validate & Error (must read)

## Validation Information

{% hint style="info" %}
Superform will perform validation in a step when it detects any of:

* **superform-validate** attribute on an element or group of elements ***and/or***
* **required** attribute on an element or group of elements.
  {% endhint %}

&#x20;**Attribute:** <mark style="color:red;">`superform-validate="identifier"`</mark>&#x20;

*eg. superform-validate="name"*

**Marks the specified element for validation by Superform.** \
The "identifier" value specifies the unique name of the input element to be validated. Superform will perform validation on this element based on the other validating attributes that the user adds. \ <mark style="background-color:red;">✔ Can be paired with an error message - see below</mark>

![](https://1615520621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhC4q4SkuRcLPZQrmF5BR%2Fuploads%2FaGYzPUCovLaJMjtztZul%2Fimage.png?alt=media\&token=2ba77b2a-dd92-4583-bf15-64b8547e15d2)![](https://1615520621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhC4q4SkuRcLPZQrmF5BR%2Fuploads%2FXZAyHkn1LAiLsTv3ZWjo%2Fimage.png?alt=media\&token=46ce7f25-52fd-43a0-90e1-c02da52cf81e)

*Images: INPUT (text) with "NAME" identifier. It will be validated for MINIMUM CHARACTERS = 1*

## Error Message Information

**Attribute:** `superform-error="identifier"`&#x20;

*eg. superform-error="name"*

Pairs an error message to the corresponding validating field and is shown during step validation.&#x20;

![](https://1615520621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhC4q4SkuRcLPZQrmF5BR%2Fuploads%2F3PLErXmxWBYIIr9qfKdp%2Fimage.png?alt=media\&token=1cfa9c6d-a7f4-4580-b728-a7f8787b4a20)![](https://1615520621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhC4q4SkuRcLPZQrmF5BR%2Fuploads%2FbPXLT5Pehs9ias7nMtRG%2Fimage.png?alt=media\&token=0f84c940-438e-4636-85df-1eefda246388)

{% hint style="warning" %}
MUST be the same "identifier" as the validating field.

example:&#x20;

superform-validate = "name"

superform-error = "name"
{% endhint %}

{% hint style="info" %}
Check which fields can be validated in the next sections.
{% endhint %}
