Form fields

Form fields can be added to any Riddle type (Poll, Quiz, Form, Predictor). They allow you to collect user input.

You can choose between two options:

  1. Add form fields to this Riddle
  2. Embed an already published from from your (personal) project

Embedding another form allows you to reuse a form you have already created (= central data collection) but also allows you to build more complex forms than with the builder API.

1. Add form fields

Like any question block, you can add form fields to the Riddle build by adding a FormBuilder block item to the blocks array.

Properties

The form fields / builder block consists of:

PropertyRequiredTypeDescription
titlestringThe title of the form builder
typestringSet to FormBuilder
fieldsobjectAn object where the key is the field label and the value is the field type. The field type must be one of the available form fields

Example

The FormBuilder block isolated:

{
    "title": "My form builder",
    "type": "FormBuilder",
    "fields": {
        "Your email": "Email",
        "Your name": "Name"
    }
}

Used in a poll build:

{
    "type": "Poll",
    "build": {
        "title": "My new poll",
        "blocks": [
            {
                "title": "The best noodles?",
                "type": "SingleChoice",
                "items": [
                    "Spaghetti",
                    "Fusilli"
                ]
            },
            {
                "title": "My form builder",
                "type": "FormBuilder",
                "fields": {
                    "Your email": "Email",
                    "Your name": "Name"
                }
            }
        ],
        "result": {
            "title": "Thank you!",
            "description": "We are happy to have you here"
        }
    }
}

Note: You can add as many form builders as you like as long as you stay within the 20 blocks limit.

Available form fields

  • Name
  • Email
  • Phone
  • URL
  • Number
  • Country
  • ShortText
  • LongText

Please note that the field type you send to the API is case-sensitive.

2. Embed an already published form

You can embed a form from your (personal) project by adding a block of the FormSelect type to the blocks array.

Properties

The form select block consists of:

PropertyRequiredTypeDescription
formstringThe UUID of the form you want to embed

Example

The FormSelect block isolated:

{
    "type": "FormSelect",
    "form": "hQ3SYWur"
}

Used in a poll build:

{
    "type": "Poll",
    "build": {
        "title": "My new poll",
        "blocks": [
            {
                "title": "The best noodles?",
                "type": "SingleChoice",
                "items": [
                    "Spaghetti",
                    "Fusilli"
                ]
            },
            {
                "type": "FormSelect",
                "form": "hQ3SYWur"
            }
        ],
        "result": {
            "title": "Thank you!",
            "description": "We are happy to have you here"
        }
    }
}