# Валидаторы форм

Очень часто перед отправкой формы, требуется произвести ее проверку на корректность заполнения полей в ней и для этого в фреймворке PipUI есть соответствующий компонент.

```html
<form method="post" class="p-20 rad-2 bg-gray-200" novalidate data-formvalidator>
    <div>
        <input type="text" name="name" class="mb-0" data-formvalidator-text="Поле является обязательным для заполнения" required placeholder="required">
    </div>

    <div class="pt-20">
        <input type="text" name="name" data-formvalidator-type="danger" class="mb-0" data-formvalidator-text="Данное поле является обязательным и принимает только цифры" required pattern="^\d+$" placeholder="Цифры">
    </div>

    <div class="pt-20 text-center">
        <button type="submit" class="btn">Отправить</button>
    </div>
</form>
```

{% embed url="<https://codepen.io/pipui/pen/QWBdgLv>" %}
Пример работы кода выше
{% endembed %}

Вы можете управлять стилем появляющейся подсказки с помощью атрибута\ <mark style="color:orange;">`[data-formvalidator-type]`</mark>, который может принимать значения: *warning*, *danger*, *info*, *success* Атрибут <mark style="color:orange;">`[data-formvalidator-text]`</mark> принимает в качестве значения тект, который будет выводится в оповещении в случает некорректного заполнения поля.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://v1-6-0.pipui.ru/components/form-validators.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
