Add form fields
Form fields can be added to any Riddle type (Poll, Quiz, Form, Predictor, Personality, Minigame, Story).
You can choose between two options:
- Add a form builder to this Riddle
- Add a single standalone form field block to this Riddle
- Embed an already published Riddle form 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.
Add a form builder
Like any other block you might add, such as SingleChoice, 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:
| Property | Required | Type | Description | Default |
|---|---|---|---|---|
type | ✓ | string | Set to FormBuilder | |
title | ✓ | string | The title of the form builder | |
fields | ✓ | object | 1-100 form fields, each an object with the field label as its title and a type - see item formats and the section below. Each field type must be one of the available form fields | |
description | string | The description of the form builder | ||
isRequired | boolean | Whether the form is required; if set to false the form can be skipped | false | |
media | string|object | Media to display as part of the form builder. Adding it automatically switches its display on. See Use media |
Example
The FormBuilder block isolated:
{
"title": "My form builder",
"type": "FormBuilder",
"fields": [
{ "title": "Your email", "type": "Email" },
{ "title": "Your name", "type": "Name" }
]
}
Used in a poll build:
{
"type": "Poll",
"build": {
"title": "My new poll",
"blocks": [
{
"title": "The best noodles?",
"type": "SingleChoice",
"items": [
{ "title": "Spaghetti" },
{ "title": "Fusilli" }
]
},
{
"title": "My form builder",
"type": "FormBuilder",
"fields": [
{ "title": "Your email", "type": "Email" },
{ "title": "Your name", "type": "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 500 blocks limit.
The fields format
fields follows the shared item formats: an array of objects, one per field. What is specific here is that a field carries two values of its own - its label, which is its title, and its type:
"fields": [
{ "title": "Your email", "type": "Email" },
{ "title": "Your name", "type": "Name", "isRequired": true }
]
Every other option of a field is a key of the same object - see the property table below.
Available form fields
| Field type | Description |
|---|---|
Name | Single-line name input |
Email | Email input with email validation |
Phone | Phone number input |
URL | URL input |
Number | Numeric input |
Country | Country picker |
ShortText | Single-line free text |
LongText | Multi-line free text |
Checkbox | A single checkbox with its own label text |
DatePicker | Date input or date picker |
TimePicker | Time input |
Dropdown | Select one option from a list (see below) |
RadioButtons | Select one option from visible radio buttons (see below) |
Rating | Star rating (see starCount) |
Media | A non-interactive image/video inside the form (see below) |
Content | A non-interactive rich text block inside the form (see below) |
Privacy | The GDPR consent block: privacy notice + consent checkboxes (see below) |
Captcha | Spam protection: Riddle's own captcha, Google reCAPTCHA, or Cloudflare Turnstile (see below) |
The field type you send to the API is case-sensitive, and the names above are the Builder API names - reading a Riddle back with riddle_get returns the same names, even though the internal storage uses slightly different ones (e.g. Dropdown is stored as DropDown).
Customizing form fields
Beyond title and type, a field object takes the options of its type - this is where you customize the field and how it behaves.
Here is an example how an Email field can be customized inside a FormBuilder block:
{
"title": "My form builder",
"type": "FormBuilder",
"fields": [
{
"title": "Your email",
"type": "Email",
"placeholder": "Enter your email address",
"isRequired": true,
"requiredMessage": "We will never share your email with anyone else."
}
]
}
Form field properties
Each form field supports different options. Unlike other blocks, a form field rejects a property its type does not support - you get a Property "x" not available in form field type "y" error rather than a silently ignored value. This table illustrates what options are available for which type:
| Property | Required | Type | Description | Available for... | Default |
|---|---|---|---|---|---|
description | string | Description of the field | all input types | ||
isDescriptionEnabled | boolean | Whether the description is shown. Sending a description switches it on; sending false keeps the description stored but hidden | all input types | derived from description | |
placeholder | string | Placeholder text | Name, Email, Phone, URL, Number, ShortText, LongText, Country, Dropdown | ||
prefilledText | string | Prefilled value; setting it also switches prefilling on | Name, Email, Phone, URL, Number, ShortText, LongText | ||
isPrefilledTextEnabled | boolean | Whether the prefilled value is used. Sending false keeps it stored but unused | Name, Email, Phone, URL, Number, ShortText, LongText | derived from prefilledText | |
isRequired | boolean | Whether the field is required | all input types | false | |
requiredMessage | string | Message shown when the field is required but not filled | all input types | ||
isHidden | boolean | Whether the field is hidden; useful in combination with the Riddle data layer | Name, Email, Phone, URL, Number, ShortText, LongText | false | |
regex | string | Regex to validate the field; setting it also switches advanced validation on | Name, Email, Phone, URL, ShortText | ||
regexValidationMessage | string | Message shown when the regex validation fails | Name, Email, Phone, URL, ShortText | ||
isAdvancedValidationEnabled | boolean | Whether the regex validation runs. Sending a regex switches it on; sending false keeps the regex stored but inactive | Name, Email, Phone, URL, ShortText, LongText | derived from regex | |
checkboxText | string | Text shown next to the checkbox | Checkbox | ||
starCount | integer | Number of rating stars to display; allowed range 0-10 | Rating | 5 | |
maxLength | integer | Maximum number of characters accepted (>= 0) | Name, Number, ShortText, LongText | 25 | |
autocomplete | string | The browser autofill hint for this field, e.g. email, given-name, tel, postal-code, off. Accepts the values of the HTML autocomplete spec | Name, Email, Phone, URL, Number, Country, ShortText, LongText | ||
customWebhookId | string | Your own identifier for this field, sent along in webhooks and integrations | all input types | ||
dateFormat | string | ddMMyyyy_dot, ddMMyyyy_slash, MMddyyyy_dot, MMddyyyy_slash, yyyy, MM, or dd | DatePicker | ddMMyyyy_slash | |
datePickerType | string | Picker (calendar overlay) or Input (typed input) | DatePicker | Input | |
timeFormat | string | HHmmss_colon, HHmm_colon, or hhmma_colon | TimePicker | HHmm_colon | |
items | object | 1-100 options, each an object with the option text as its title - see item formats | Dropdown, RadioButtons | ||
mediaOrientation | string | Settings, Wide, Square, Tall, or Original | all input types, Media | Settings |
The three is...Enabled flags follow the general feature toggle rule: supplying the content switches the feature on, and an explicit flag always wins.
Two properties depend on another one:
requiredMessagemay only be set on a field that is alsoisRequired: true- otherwise the build fails.regexValidationMessagemay only be set together withregex.
Media, Content, Privacy and Captcha are not input fields and have their own, separate property sets - see the sections below.
Adding radio buttons and dropdowns
The RadioButtons and Dropdown field types can be used to create a list of options. You can add as many options as you like in the items array, which follows the shared item formats: an object per option, its text in title. Unlike the surrounding fields, an option needs no type.
Note: On the public API, the fields array of a FormBuilder block (and the items array of a Dropdown or RadioButtons field) is limited to a maximum of 100 entries.
Example FormBuilder object:
{
"title": "My form builder",
"type": "FormBuilder",
"fields": [
{
"title": "Your favorite color",
"type": "RadioButtons",
"items": [
{ "title": "Red" },
{ "title": "Green" },
{ "title": "Blue" }
]
},
{
"title": "Your favorite animal",
"type": "Dropdown",
"items": [
{ "title": "Dog" },
{ "title": "Cat" },
{ "title": "Fish" }
]
}
]
}
An option object also takes a stable id of your own:
"items": [
{ "id": 10, "title": "Red" },
{ "id": 20, "title": "Green" }
]
Learn more about setting custom ids here.
Adding content and media fields
The Content and Media field types can be used to add additional information to your form.
| Field | Property | Required | Type | Description | Default |
|---|---|---|---|---|---|
Content | text | ✓ | string | The rich text to display | |
Media | media | ✓ | string|object | The image or video to display | |
Media | mediaOrientation | string | Set to Settings, Wide, Square, Tall or Original | Settings |
Example FormBuilder with Content and Media fields:
{
"title": "My form builder",
"type": "FormBuilder",
"fields": [
{
"type": "Content",
"text": "<h2>Welcome to the survey!</h2><p>Please fill out the form below.</p>"
},
{
"type": "Media",
"media": "https://httpbin.io/image/jpeg",
"mediaOrientation": "Wide"
}
]
}
Note: Neither field carries a title - a Content field is its text and a Media field is its media. This is the one place in fields where title is not part of the field.
Adding a privacy / GDPR consent field
The Privacy field holds your privacy notice plus the two consent checkboxes a lead capture form needs to be legally usable in the EU. There are always exactly these two checkboxes - you cannot add your own.
| Property | Required | Type | Description | Default |
|---|---|---|---|---|
privacyText | string | Your privacy notice, shown above the checkboxes | ||
requiredConsentForAddRiddleData | object | Consent to combining the visitor's Riddle answers with their form data | enabled | |
requiredConsentForTracking | object | Consent to the custom trackers configured for this Riddle | disabled | |
isLeadIdVisible | boolean | Whether the lead's unique ID is shown to them | false | |
isSaveByRiddleMessageVisible | boolean | Whether a "your data has been saved" confirmation is shown | false |
Both consent objects take the same properties:
| Property | Required | Type | Description | Default |
|---|---|---|---|---|
isEnabled | boolean | Whether this checkbox is shown to the visitor at all | ||
isRequired | boolean | Whether the visitor must tick it to submit | ||
label | string | The question above the checkbox | ||
description | string | Additional explanation | ||
checkboxText | string | The text next to the checkbox itself |
{
"title": "My form builder",
"type": "FormBuilder",
"fields": [
{ "title": "Your email", "type": "Email" },
{
"type": "Privacy",
"privacyText": "<p>We store your email to send you the results. See our privacy policy.</p>",
"requiredConsentForAddRiddleData": {
"isEnabled": true,
"isRequired": true,
"label": "<p>May we combine your answers with your email?</p>",
"checkboxText": "<p>Yes, you may</p>"
},
"requiredConsentForTracking": {
"isEnabled": false
}
}
]
}
Double opt-in (DOI) confirmation is not part of this field - it is a Riddle-wide publish setting, see publish settings.
Adding a captcha field
| Property | Required | Type | Description | Default |
|---|---|---|---|---|
captchaType | string | riddle (Riddle's own question/answer challenge), google (reCAPTCHA), or cloudflare (Turnstile) | riddle | |
label | string | The challenge question - riddle type only | ||
description | string | Additional explanation - riddle type only | ||
key | string | The vendor's site key - google/cloudflare only | ||
secret | string | The vendor's secret key - google/cloudflare only |
A google or cloudflare captcha is rejected unless both key and secret are set (empty strings do not count) - a vendor captcha cannot work without them.
Note: secret is write-only. It is never returned when you read a Riddle back as a build configuration, so a credential is not handed out to anyone who can read the Riddle's structure. key is returned - it is the public site key the widget renders into the page anyway. Because a read never returns the secret, re-sending a fetched configuration as an edit keeps the stored one; only a create has to supply it.
{
"type": "Captcha",
"captchaType": "cloudflare",
"key": "0x4AAA...",
"secret": "0x4AAA..."
}
Adding single standalone form field blocks
If you want to add a single form field instead of a full form builder, you can do so by adding the respective form field type directly to the blocks array.
| Property | Required | Type | Description | Default |
|---|---|---|---|---|
type | ✓ | string | Set to FormField | |
title | ✓ | string | The title of the form field | |
fieldType | ✓ | string | The type of the form field, must be one of the available form fields | |
description | string | The description of the form field | ||
media | string|object | Media to display as part of the form field. Adding it automatically switches its display on | ||
mediaOrientation | string | Settings, Wide, Square, Tall, or Original | Settings | |
label | string | A label shown alongside the form field | ||
isRequired | boolean | Whether the field is required | false |
In addition to the common properties, each form field type supports the same options as described in the Customizing form fields section.
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:
| Property | Required | Type | Description | Default |
|---|---|---|---|---|
form | ✓ | string | The UUID of the form you want to embed |
The referenced Riddle must exist, must be of type Form, and must be accessible to you - otherwise the build fails.
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": [
{ "title": "Spaghetti" },
{ "title": "Fusilli" }
]
},
{
"type": "FormSelect",
"form": "hQ3SYWur"
}
],
"result": {
"title": "Thank you!",
"description": "We are happy to have you here"
}
}
}
Referencing form fields later
Form fields are what leaderboards and dynamic variables refer back to. You can either reference a field by its label (e.g. "Your email") or by the canonical field key that reading the Riddle back reports (e.g. email1). You can also pin your own id on a field - see custom IDs.
Full example
A complete Form request body with the standalone field blocks from this page built into it.
{
"type": "Form",
"build": {
"title": "Form example (Builder API)",
"blocks": [
{
"title": "Your favorite animal",
"type": "FormField",
"fieldType": "Dropdown",
"items": [
{ "title": "Dog" },
{ "title": "Cat" },
{ "title": "Fish" }
]
},
{
"title": "Your email",
"type": "FormField",
"fieldType": "Email",
"placeholder": "Enter your email address",
"isRequired": true,
"requiredMessage": "We will never share your email with anyone else."
}
]
}
}

