> 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-validation-types.md).

# FormFieldValidationTypes

## Introduction

`FormFieldValidationTypes` associated to [FormFieldValidations](/api-reference/forms/form-field-validations.md) by their `key` describe how an applied validation should be interpreted.

Every `FormFieldValidationType` offers a generic default configuration and describes how a concrete configuration is validated when creating a [FormFieldValidation](/api-reference/forms/form-field-validations.md).

## List

Get a list of all `FormFieldValidationTypes`.

**Definition**

<mark style="color:green;">`GET`</mark> `/api/forms/field-validation-types`

**Example Request**

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

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

{% endtab %}
{% endtabs %}

**Example Response**

```json
[
  {
    "id": "required",
    "default_config": {},
    "sort_number": 1,
    "created_at": "2019-01-21 00:00:00",
    "updated_at": "2019-01-21 00:00:00"
  },
  {
    "id": "email",
    "default_config": {},
    "sort_number": 2,
    "created_at": "2019-01-21 00:00:00",
    "updated_at": "2019-01-21 00:00:00"
  },
  {
    "id": "phone",
    "default_config": {
      "fixed_line": true,
      "mobile": true,
      "country_codes": null,
      "default_country_code": "DE"
    },
    "sort_number": 3,
    "created_at": "2019-01-21 00:00:00",
    "updated_at": "2019-01-21 00:00:00"
  },
  {
    "id": "url",
    "default_config": {},
    "sort_number": 4,
    "created_at": "2019-01-21 00:00:00",
    "updated_at": "2019-01-21 00:00:00"
  },
  {
    "id": "number",
    "default_config": {
      "type": "numeric"
    },
    "sort_number": 5,
    "created_at": "2019-01-21 00:00:00",
    "updated_at": "2019-01-21 00:00:00"
  },
  {
    "id": "minmax",
    "default_config": {
      "min": 0
    },
    "sort_number": 6,
    "created_at": "2019-01-21 00:00:00",
    "updated_at": "2019-01-21 00:00:00"
  },
  {
    "id": "items-count",
    "default_config": {
      "min": 0
    },
    "sort_number": 7,
    "created_at": "2019-01-21 00:00:00",
    "updated_at": "2019-01-21 00:00:00"
  },
  {
    "id": "boolean",
    "default_config": {},
    "sort_number": 8,
    "created_at": "2019-01-21 00:00:00",
    "updated_at": "2019-01-21 00:00:00"
  },
  {
    "id": "datetime",
    "default_config": {
      "format": "Y-m-d H:i:s"
    },
    "sort_number": 9,
    "created_at": "2019-01-21 00:00:00",
    "updated_at": "2019-01-21 00:00:00"
  },
  {
    "id": "after-before",
    "default_config": {
      "after": "now"
    },
    "sort_number": 10,
    "created_at": "2019-01-21 00:00:00",
    "updated_at": "2019-01-21 00:00:00"
  },
  {
    "id": "file",
    "default_config": {},
    "sort_number": 11,
    "created_at": "2019-01-21 00:00:00",
    "updated_at": "2019-01-21 00:00:00"
  },
  {
    "id": "mimetypes",
    "default_config": {
      "allowed": ["image/gif", "image/jpeg", "image/png", "image/tiff"]
    },
    "sort_number": 12,
    "created_at": "2019-01-21 00:00:00",
    "updated_at": "2019-01-21 00:00:00"
  },
  {
    "id": "last-modified",
    "default_config": {
      "before": "now"
    },
    "sort_number": 13,
    "created_at": "2019-01-21 00:00:00",
    "updated_at": "2019-01-21 00:00:00"
  },
  {
    "id": "in",
    "default_config": {
      "values": []
    },
    "sort_number": 14,
    "created_at": "2019-01-21 00:00:00",
    "updated_at": "2019-01-21 00:00:00"
  },
  {
    "id": "not-in",
    "default_config": {
      "values": []
    },
    "sort_number": 15,
    "created_at": "2019-01-21 00:00:00",
    "updated_at": "2019-01-21 00:00:00"
  }
]
```

## Show

Show a single `FormFieldValidationType` by `id`.

**Definition**

<mark style="color:green;">`GET`</mark> `/api/forms/field-validation-types/{id}`

**Example Request**

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

```php
$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('GET', '/api/forms/field-validation-types/number', [
    'headers' => ['Authorization' => "Bearer {accessToken}"]
]);

```

{% endtab %}
{% endtabs %}

**Example Response**

```json
[]
```

## Required

The field will be marked and validated as required.

**Key** `required`

**Configuration**

No further configuration available.

## Url

The field value has to be a valid URL.

**Key** `url`

**Configuration**

No further configuration available.

## DateTime

The field value has to be a valid date/time according to the format configuration.

**Key** `datetime`

**Configuration**

| Key         | Description                                | Type   | Default       | Example |
| ----------- | ------------------------------------------ | ------ | ------------- | ------- |
| `format` \* | The date/time format the value should have | string | `Y-m-d H:i:s` | `H:i`   |

Keys with `*` are required.

## MimeTypes

The input file will be validated to have one of the defined mimetypes.

**Key** `mimetypes`

**Configuration**

| Key          | Description             | Type  | Default                                                      | Example               |
| ------------ | ----------------------- | ----- | ------------------------------------------------------------ | --------------------- |
| `allowed` \* | The supported mimetypes | array | `["image\/gif", "image\/jpeg", "image\/png", "image\/tiff"]` | `["application/pdf"]` |

Keys with `*` are required.

## Email

The field value has to be a valid email address.

**Key** `email`

**Configuration**

No further configuration available.

## Number

The field value has to be a number.

**Key** `number`

**Configuration**

| Key       | Description            | Type   | Default   | Example   |
| --------- | ---------------------- | ------ | --------- | --------- |
| `type` \* | The type of the number | string | `numeric` | `integer` |

Keys with `*` are required.

## MinMax

The field value has to be a number in the defined valid range.

**Key** `minmax`

**Configuration**

| Key   | Description   | Type    | Default | Example |
| ----- | ------------- | ------- | ------- | ------- |
| `min` | Minimum value | integer | `0`     | `5`     |
| `max` | Maximum value | integer | -       | `10`    |

At least one of `min` or `max` must be set.

## ItemsCount

The field value has to contain a valid number of selected items.

This is primarily useful for multi-value fields (e.g. checkbox or entities-select), where the submitted value may contain multiple entries.

**Key** `items-count`

**Configuration**

| Key   | Description         | Type    | Default | Example |
| ----- | ------------------- | ------- | ------- | ------- |
| `min` | Minimum items count | integer | `0`     | `1`     |
| `max` | Maximum items count | integer | -       | `3`     |

At least one of `min` or `max` must be set.

## Phone

The field value has to be a valid phone number.

**Key** `phone`

**Configuration**

| Key                    | Description                        | Type            | Default | Example        |
| ---------------------- | ---------------------------------- | --------------- | ------- | -------------- |
| `fixed_line`           | Allow fixed-line numbers           | boolean         | `true`  | `false`        |
| `mobile`               | Allow mobile numbers               | boolean         | `true`  | `true`         |
| `country_codes`        | Restrict to specific country codes | string\[]\|null | `null`  | `["DE", "AT"]` |
| `default_country_code` | Default country code for parsing   | string          | `DE`    | `US`           |

## Boolean

The field value has to be a boolean.

**Key** `boolean`

**Configuration**

No further configuration available.

## AfterBefore

The field value has to be after and/or before the configured relative date values.

**Key** `after-before`

**Configuration**

| Key      | Description                 | Type   | Default | Example       |
| -------- | --------------------------- | ------ | ------- | ------------- |
| `after`  | Lower bound (relative date) | string | `now`   | `now -1 day`  |
| `before` | Upper bound (relative date) | string | -       | `now +1 week` |

At least one of `after` or `before` must be set.

## File

The field value has to be a file upload.

**Key** `file`

**Configuration**

No further configuration available.

## LastModified

Validates client-side "last modified" metadata for uploaded files.

**Key** `last-modified`

**Configuration**

| Key      | Description                 | Type   | Default | Example       |
| -------- | --------------------------- | ------ | ------- | ------------- |
| `after`  | Lower bound (relative date) | string | -       | `now -1 year` |
| `before` | Upper bound (relative date) | string | `now`   | `now -1 week` |

At least one of `after` or `before` must be set.

## In

The field value has to be one of the configured values.

**Key** `in`

**Configuration**

| Key        | Description    | Type      | Default | Example                |
| ---------- | -------------- | --------- | ------- | ---------------------- |
| `values`\* | Allowed values | string\[] | `[]`    | `["value1", "value2"]` |

Keys with `*` are required.

## NotIn

The field value must not be one of the configured values.

**Key** `not-in`

**Configuration**

| Key        | Description      | Type      | Default | Example                |
| ---------- | ---------------- | --------- | ------- | ---------------------- |
| `values`\* | Forbidden values | string\[] | `[]`    | `["value1", "value2"]` |

Keys with `*` are required.
