Skip to content

FormFieldValidations

Introduction

FormFieldValidations are related to FormFields and describe how input fields should be validated when a User enters information or submits the Form.

How a field should be validated is determined by it's FormFieldValidationType associated by thw key and the config.

Model & Relations

Namespace

Modules\Forms\Entities\FormFieldValidation

Relations

RelationKeyTypeRelation Field(s)
FormFieldformFieldBelongs toform_field_id
FormFieldValidationTypeformFieldValidationTypeBelongs toform_field_validation_type_id

Computed Properties

  • validation_string - The resulting validation string from the configuration

[Adm.] Create

Create a new FormFieldValidation.

Definition

POST /api/administration/forms/fields/validations

Request Keys

KeyTypeDefaultDescription
form_field_id *integer-The related FormField
form_field_validation_type_id *integer-The related FormFieldValidationTyp
configjsonDefault FormFieldValidationTyp configThe scheme how the data has to be stored to pass the validation

Keys with * are required.

Example Request

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'
    ]
]);

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

PUT /api/administration/forms/fields/validations/{id}

Request Keys

KeyTypeDescription
form_field_idintegerThe related FormField
form_field_validation_type_idintegerThe related FormFieldValidationTyp
configjsonThe scheme how the data has to be stored to pass the validation

Example Request

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'
    ]
]);

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

DELETE /api/administration/forms/fields/validations/{id}

Example Request

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}"]
]);

Example Response

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