> For the complete documentation index, see [llms.txt](https://docs.api.intratool.de/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.api.intratool.de/api-reference/forms/form-field-validations.md).

# FormFieldValidations

## Introduction

FormFieldValidations are related to [FormFields](/api-reference/forms/form-fields.md) and describe how input fields should be validated when a [User](/api-reference/users.md) enters information or submits the [Form](/api-reference/forms/forms.md).

How a field should be validated is determined by it's [FormFieldValidationType](/api-reference/forms/form-field-validation-types.md) associated by thw `key` and the `config`.

## Model Definition

**Alias**

`formFieldValidation`

**Relations**

| Relation                                                                       | Key                       | Type       | Relation Field(s)               |
| ------------------------------------------------------------------------------ | ------------------------- | ---------- | ------------------------------- |
| [FormField](/api-reference/forms/form-fields.md)                               | `formField`               | Belongs to | `form_field_id`                 |
| [FormFieldValidationType](/api-reference/forms/form-field-validation-types.md) | `formFieldValidationType` | Belongs to | `form_field_validation_type_id` |

**Computed Properties**

* `validation_string` - The resulting validation string from the configuration

## \[Adm.] Create

Create a new `FormFieldValidation`.

**Definition**

<mark style="color:yellow;">`POST`</mark> `/api/administration/forms/fields/validations`

**Request Keys**

| Key                                |   Type  |                                            Default                                           | Description                                                                               |
| ---------------------------------- | :-----: | :------------------------------------------------------------------------------------------: | ----------------------------------------------------------------------------------------- |
| `form_field_id` \*                 | integer |                                               -                                              | The related [FormField](/api-reference/forms/form-fields.md)                              |
| `form_field_validation_type_id` \* | integer |                                               -                                              | The related [FormFieldValidationTyp](/api-reference/forms/form-field-validation-types.md) |
| `config`                           |   json  | Default [FormFieldValidationTyp](/api-reference/forms/form-field-validation-types.md) config | The scheme how the data has to be stored to pass the validation                           |

Keys with `*` are required.

**Example Request**

{% tabs %}
{% tab title="PHP" %}

```php
$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('POST', '/api/administration/forms/fields/validations', [
    'headers' => ['Authorization' => "Bearer {accessToken}"],
    'json' => [
        'form_field_id' => 7,
        'form_field_validation_type_id' => 'email'
    ]
]);
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "status": "success",
  "data": {
    "form_field_id": 7,
    "form_field_validation_type_id": "email",
    "config": {},
    "updated_at": "2019-01-25 14:47:40",
    "created_at": "2019-01-25 14:47:40",
    "id": 5,
    "validation_string": "email",
    "form_field_validation_type": {
      "id": "email",
      "default_config": {},
      "sort_number": 2,
      "created_at": "2019-01-21 00:00:00",
      "updated_at": "2019-01-21 00:00:00"
    }
  }
}
```

## \[Adm.] Update

Update an existing `FormFieldValidation` by `id`.

**Definition**

<mark style="color:blue;">`PUT`</mark> `/api/administration/forms/fields/validations/{id}`

**Request Keys**

| Key                             |   Type  | Description                                                                               |
| ------------------------------- | :-----: | ----------------------------------------------------------------------------------------- |
| `form_field_id`                 | integer | The related [FormField](/api-reference/forms/form-fields.md)                              |
| `form_field_validation_type_id` | integer | The related [FormFieldValidationTyp](/api-reference/forms/form-field-validation-types.md) |
| `config`                        |   json  | The scheme how the data has to be stored to pass the validation                           |

**Example Request**

{% tabs %}
{% tab title="PHP" %}

```php
$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('PUT', '/api/administration/forms/fields/validations/5', [
    'headers' => ['Authorization' => "Bearer {accessToken}"],
    'json' => [
        'form_field_id' => 7,
        'form_field_validation_type_id' => 'required'
    ]
]);

```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "status": "success",
  "data": {
    "id": 5,
    "form_field_id": 7,
    "form_field_validation_type_id": "required",
    "config": {},
    "created_at": "2019-01-25 14:47:40",
    "updated_at": "2019-01-25 14:55:21",
    "validation_string": "required",
    "form_field_validation_type": {
      "id": "required",
      "default_config": {},
      "sort_number": 1,
      "created_at": "2019-01-21 00:00:00",
      "updated_at": "2019-01-21 00:00:00"
    }
  }
}
```

## \[Adm.] Delete

Delete an existing `FormFieldValidation` by `id`.

**Definition**

<mark style="color:red;">`DELETE`</mark> `/api/administration/forms/fields/validations/{id}`

**Example Request**

{% tabs %}
{% tab title="PHP" %}

```php
$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('DELETE', '/api/administration/forms/fields/validations/5', [
    'headers' => ['Authorization' => "Bearer {accessToken}"]
]);
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "status": "success",
  "data": {
    "count": 1
  }
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.api.intratool.de/api-reference/forms/form-field-validations.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
