# FormMessageFields

## Introduction

`FormMessageFields` represent the input values for [FormFields](https://docs.api.intratool.de/api-reference/forms/form-fields) that are sent when a [User](https://docs.api.intratool.de/api-reference/users) submits a [Form](https://docs.api.intratool.de/api-reference/forms/forms).

Every submitted [Form](https://docs.api.intratool.de/api-reference/forms/forms) will have a set of `FormMessageFields` as value representations according to the defined [FormFields](https://docs.api.intratool.de/api-reference/forms/form-fields) when saved.

The values of `FormMessageFields` result in a [FormMessage](https://docs.api.intratool.de/api-reference/forms/form-messages) after processing, which is then sent via E-Mail.

## Model Definition

**Relations**

| Relation                                                                       | Key           | Type       | Relation Field(s) |
| ------------------------------------------------------------------------------ | ------------- | ---------- | ----------------- |
| [FormField](https://docs.api.intratool.de/api-reference/forms/form-fields)     | `formField`   | Belongs to | `form_field_id`   |
| [FormMessage](https://docs.api.intratool.de/api-reference/forms/form-messages) | `formMessage` | Belongs to | `form_message_id` |

## List by message

Get a list of `FormMessageFields` for the given [FormMessage](https://docs.api.intratool.de/api-reference/forms/form-messages).

**Definition**

<mark style="color:green;">`GET`</mark> `/api/forms/messages/{formMessageId}/fields`

**Example Request**

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

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

{% endtab %}
{% endtabs %}

**Example Response**

```json
[
  {
    "id": 1,
    "form_message_id": 1,
    "form_field_id": 1,
    "value": "1",
    "request_value": "1",
    "created_at": "2024-10-01 12:00:00",
    "updated_at": "2024-10-01 12:00:00",
    "deleted_at": null
  },
  {
    "id": 2,
    "form_message_id": 1,
    "form_field_id": 2,
    "value": "2",
    "request_value": "2",
    "created_at": "2024-10-01 12:00:00",
    "updated_at": "2024-10-01 12:00:00",
    "deleted_at": null
  },
  {
    "id": 3,
    "form_message_id": 1,
    "form_field_id": 3,
    "value": "3",
    "request_value": "3",
    "created_at": "2024-10-01 12:00:00",
    "updated_at": "2024-10-01 12:00:00",
    "deleted_at": null
  }
]
```

## Show by message and field

Show a single `FormMessageField` for the given [FormMessage](https://docs.api.intratool.de/api-reference/forms/form-messages) and [FormField](https://docs.api.intratool.de/api-reference/forms/form-fields).

**Definition**

<mark style="color:green;">`GET`</mark> `/api/forms/messages/{formMessageId}/fields/{formFieldId}`

**Example Request**

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

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

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "id": 1,
  "form_message_id": 1,
  "form_field_id": 1,
  "value": "1",
  "request_value": "1",
  "created_at": "2024-10-01 12:00:00",
  "updated_at": "2024-10-01 12:00:00",
  "deleted_at": null
}
```
