1. Fields
  2. Object Builder Field

Fields

Object Builder Field

The Object Builder Field allows for creating an object field.

This field builds up a JS object of key value pairs.
It presents a key field and a value field, within which the user can capture the key value pairs.

Basic usage

Adds an objectbuilder field to the fields of an action.

{
special_requests
:
{
fieldtype
:
objectbuilder

Result

The field will be displayed as a field that allows you to build custom objects in the form, as below:

The resultant data will be available in the stubpost.data as:

{
special_requests
:
{
checked_luggage
:
Yes please, I have a lot of luggage.
pet_needs
:
Can my pet snake fly with me?
harmful_materials
:
Does my laptop charger count as a harmful material?

This can be substituted with eg. ~~stubpost.data.special_requests where required.

Parameters

See fields for common field parameters like validation and conditional rendering.

params.key_field_spec
optional
object

A field specification object that defines what kind of field the key should be.

Default: text field


params.value_field_spec
optional
object

A field specification object that defines what kind of field the value should be.

Default: text field


Examples

Custom key_field_spec

The key_field_spec parameter has been configred to use a select field.
This means that the key field will now render a select field, and all the usual params of the select field can be passed through.

{
fieldtype
:
objectbuilder
params
:
{
key_field_spec
:
{
fieldtype
:
select
params
:
{
options
:
[
5 items  
0
:
{
label
:
Content-Type
value
:
Content-Type
1
:
{
label
:
Authorization
value
:
Authorization
2
:
{
label
:
Accept
value
:
Accept
3
:
{
label
:
User-Agent
value
:
User-Agent
4
:
{
label
:
Host
value
:
Host

Demo Gif

Resultant Data

{
headers
:
{
Authorization
:
Bearer xyz
Content-Type
:
application/json