> 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` apply a [FormFieldValidationType](/api-reference/forms/form-field-validation-types.md) to a [FormField](/api-reference/forms/form-fields.md).

## Model Definition

**Alias**

`formFieldValidation`

**Relations**

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

## Admin: 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` | -            | Target [FormField](/api-reference/forms/form-fields.md) ID.                                                                                                                       |
| `form_field_validation_type_id`\* | `string`  | -            | ID from [Available Form Field Validation Types](/api-reference/forms/form-field-validation-types.md#available-form-field-validation-types).                                       |
| `config`                          | `object`  | Type default | Type-specific configuration documented with the selected [Form Field Validation Type](/api-reference/forms/form-field-validation-types.md#available-form-field-validation-types). |

Keys with `*` are required.

**Behavior**

* When `config` is omitted, the selected validation type's `default_config` is inserted before validation.
* The `in`, `not-in`, and `regex` defaults are editor placeholders and must be populated in the create request.

**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' => 33,
        'form_field_validation_type_id' => 'required',
        'config' => [

        ]
    ]
]);
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "status": "success",
  "data": {
    "id": 91,
    "form_field_id": 33,
    "form_field_validation_type_id": "required",
    "config": {}
  }
}
```

## Admin: Update

Update an existing `FormFieldValidation`.

**Definition**

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

**Route Parameters**

| Parameter             | Type      | Description    |
| --------------------- | --------- | -------------- |
| `formFieldValidation` | `integer` | Validation ID. |

**Request Keys**

| Key                             | Type      | Default       | Description                                                                                                                                                                       |
| ------------------------------- | --------- | ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `form_field_id`                 | `integer` | Current value | Target field ID.                                                                                                                                                                  |
| `form_field_validation_type_id` | `string`  | Current value | New ID from [Available Form Field Validation Types](/api-reference/forms/form-field-validation-types.md#available-form-field-validation-types).                                   |
| `config`                        | `object`  | Current value | Type-specific configuration documented with the selected [Form Field Validation Type](/api-reference/forms/form-field-validation-types.md#available-form-field-validation-types). |

**Behavior**

* When the validation type is unchanged and `config` is omitted, the current config remains unchanged.
* When `form_field_validation_type_id` changes and `config` is omitted, validation uses the new type's `default_config`. Submit `config` in the same request for `in`, `not-in`, or `regex`.

**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/91', [
    'headers' => ['Authorization' => "Bearer {accessToken}"],
    'json' => [
        'form_field_validation_type_id' => 'email',
        'config' => [

        ]
    ]
]);
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "status": "success",
  "data": {
    "id": 91,
    "form_field_id": 33,
    "form_field_validation_type_id": "email",
    "config": {}
  }
}
```

## Admin: Delete

Delete an existing `FormFieldValidation`.

**Definition**

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

**Route Parameters**

| Parameter             | Type      | Description    |
| --------------------- | --------- | -------------- |
| `formFieldValidation` | `integer` | Validation 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/91', [
    'headers' => ['Authorization' => "Bearer {accessToken}"]
]);
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "status": "success",
  "data": null
}
```
