create_text_box_element

Admin-only MCP tool.

Create a new Text Box Element in a Formulize form.

Newly created elements appear on the pages of form screens where all other elements in the form already appear. To add a newly created element to a form screen page which only has some existing elements, use the update_form_screen tool.

Text Boxes Elements have different properties depending on their type.

You must use the valid properties for each type. Here is a complete list of available types, their properties, and examples:

Element: Email Address (email)

Description: A single line box for entering an email address. The address is checked for validity, to prevent non-email addresses from being saved.

Properties:

  • none. Email Address elements have no properties. They are always simply an empty text box for entering an email address.

Examples:

  • A phone number element requires no properties: { }

Element: Number Box (number)

Description: A single line box for entering numbers, with optional formatting for decimals, prefixes, suffixes, and thousands separators.

Properties:

  • size (int, width of the box in characters, default is 30)
  • defaultValue (int or float, default value for new entries)
  • decimals (int, number of decimal places to allow, default is 0),
  • min (int, lowest value allowed, default is null, no minimum),
  • max (int, highest value allowed, default is null, no maximum),
  • prefix (string, text to show before the number, default is ‘’),
  • decimalsSeparator (string, character to use as the decimal separator, default is ‘.’)
  • thousandsSeparator (string, character to use as the thousands separator, default is ‘,’)
  • suffix (string, text to show after the number, default is ‘’)

Examples:

  • A basic number box requires no properties, system defaults will be used
  • A number box for recording values between 0 and 99: { size: 2, min: 0, max: 99 }
  • A three digit number box with a default value of 100: { size: 3, defaultValue: 100 }
  • A number box for recording prices up to $999,999.99: { size: 9, defaultValue: 0, decimals: 2, prefix: ‘$’, thousandsSeparator: ‘,’, decimalsSeparator: ‘.’ }

Element: Phone Number (phone)

Description: A single line box for entering a phone number. Enforces a specific format on the number that the user enters.

Properties:

  • phoneNumberFormat (string, a series of Xs plus other characters, to indicate the way that phone numbers should be formatted, in the predomonant locale among the users. For example, XXXX-XXXX for two groups of four digits with a hyphen in the middle. Users can enter numbers in whatever way they want and with whatever formatting, hyphens or no hyphens, etc. Users must enter a number of digits equal to the number of Xs in the prescribed format. The prescribed format will be used to standardize the number formatting when saved. If no phoneNumberFormat is provided then XXX-XXX-XXXX is used, ie: standard North American phone number format.)

Examples:

  • A phone number element that requires the user to enter six digits, that will be formatted as one set of six: { phoneNumberFormat: “XXXXXX” }
  • A phone number element that will store standard North American phone numbers (the default format, so no need to specify anything): { }

Element: Text Box (text).

Description: A single-line text input field.

Properties:

  • defaultValue (string, the default value for the text box)

Examples:

  • A plain text box with no default value: { }
  • A text box with a default value of ‘N/A’: { defaultValue: “N/A” }

Element: Multi-line Textbox (textarea).

Description: A multi-line text input field. Useful for addresses, notes, and other longer text inputs. Can be set to provide a rich text editor to the user.

Properties:

  • defaultValue (optional, string, default value for new entries)
  • useRichTextEditor (optional, a 1/0 indicating whether to provide a rich text editor for this field. Default is 0 (no editor). Set to 1 to provide an editor.)
  • counterType (optional, one of ‘none’, ‘characters’, or ‘words’. Sets whether a character or word counter is shown below the field. Default is ‘none’ (no counter). Not applicable when useRichTextEditor is 1.)
  • limitNumber (optional, non-negative integer. Only relevant when counterType is ‘characters’ or ‘words’. If 0 or omitted, the counter counts up with no maximum. If greater than 0, it also acts as a hard limit that the user cannot exceed.)

Examples:

  • A rich text editor box: { useRichTextEditor: 1 }
  • A multi-line text box for addresses in Toronto, ON: { defaultValue: ‘Toronto, ON’ }
  • A notes field with a character counter but no maximum: { counterType: ‘characters’ }
  • A notes field limited to 200 characters: { counterType: ‘characters’, limitNumber: 200 }
  • A short essay field limited to 500 words: { counterType: ‘words’, limitNumber: 500 }

Properties

Property Type Required? Description
form_id integer Required

Required. ID of the form that this will be part of.

type string (one of: email, number, phone, text, textarea) Required

Required. The type of Text Box Element to create.

caption string Required

Required. The label for the Text Box Element as it will appear to users in forms and in lists.

properties object Required

Required. Additional configuration settings for the Text Box Element. The available properties depend on the element type. See the tool description for examples of what properties are needed for different element types.

column_heading string Optional

Optional. The heading to use at the top of a column in lists of entries. If not specified, the caption will be used. Some captions are long and descriptive, and a shorter heading would be more appropriate for in a list of data.

help_text_for_users string Optional

Optional. A longer description or help text for the Text Box Element, shown to users filling out the form. This is NOT an internal notes field, this content appears as part of the element.

required boolean Optional

Optional. Whether the Text Box Element is required to have a value when users fill out the form. Default: false

principal_identifier boolean Optional

Optional. Whether the Text Box Element is the principal identifying element for entries in this form. Principal identifiers are used in various places in Formulize to represent an entry. The Principal Identifier would typically be a ‘Name’ text box or other element that unique identifies the entry. Each form can only have one Principal Identifier. If a form has a Principal Identifier, and another element is created or updated with this value set to true, the existing Principal Identifier will be replaced with the new one. Default: false.

disabled boolean Optional

Optional. Whether the Text Box Element element is disabled (visible but not usable) in the form. Default: false.

handle string Optional

This is the internal name, used in the database and in API calls. This is optional and does not normally need to be specified, as the system will determine it automatically from the form title and element caption. If the user specifically requests a handle, use this to force the handle to be a certain value. The system may still modify it for uniqueness, so check the tool result to see the actual handle used in by system. Maximum length is 64 characters.

display_conditions array of object Optional

Optional. A given form entry must meet these conditions in order for this element to be displayed; otherwise it is not shown. Each condition includes an element, an operator, a value, and a ‘type’ flag indicating the logical set the condition belongs to: ‘match-all’ or ‘match-one-or-more’. Multiple match-all conditions are joined with a logical AND operator, and multiple match-one-or-more conditions are joined with a logical OR operator. Provide a list of conditions to restrict when the element is displayed; if you omit this property (or provide an empty array) it has no conditions and is always displayed. When setting conditions based on linked elements, do not use foreign keys as values, and instead use the readable value which this tool understands automatically. Use the special value “{BLANK}” (without quotes) to match blank values.
Examples:

  • [ { “element”: “status”, “operator”: “=”, “value”: “Approved”, “type”: “match-all” } ]
  • [ { “element”: “award_value”, “operator”: “>”, “value”: “500”, “type”: “match-all” }, { “element”: “award_year”, “operator”: “=”, “value”: “2026”, “type”: “match-all” } ] Match size 40 pants OR green pants:
  • [ { “element”: “pant_size”, “operator”: “=”, “value”: “40”, “type”: “match-one-or-more” }, { “element”: “pant_color”, “operator”: “=”, “value”: “green”, “type”: “match-one-or-more” } ] Match incomplete orders that are due before today, and are going to either Canada or Mexico:
  • [ { “element”: “order_state”, “operator”: “=”, “value”: “incomplete”, “type”: “match-all” }, { “element”: “order_due_date”, “operator”: “<”, “value”: “{TODAY}”, “type”: “match-all” }, { “element”: “order_destination”, “operator”: “=”, “value”: “Canada”, “type”: “match-one-or-more” }, { “element”: “order_destination”, “operator”: “=”, “value”: “Mexico”, “type”: “match-one-or-more” } ] Do not use foreign key values with linked elements; use the readable value instead:
  • Incorrect: [ { “element”: “assigned_judge”, “operator”: “LIKE”, “value”: “509”, “type”: “match-all” } ]
  • Correct: [ { “element”: “assigned_judge”, “operator”: “LIKE”, “value”: “Wapner”, “type”: “match-all” } ]
placement string Optional

The canonical position of the element in the form. This order is used on every form screen page that this element has been added to (newly created elements are automatically added to all pages that currently have all existing elements; to add an element to a page that has only some existing elements, use the update_form_screen tool). Use “top” to make this element the first element in the form, use “bottom” to make this element the last (which is the default for new elements), or use an element handle to place this element immediately after that element (based on the live state of the form at the time of this specific request; re-fetch get_form_details first if you need to see the current element order). On updates, omit this to leave the current position unchanged.

data_type string Optional

Optional. The MariaDB data type to be used for the field in the database where this data will be stored. The system will default to text in most cases, but will set smart defaults if the type is specifically a number box or a linked element storing foreign keys, etc. Generally this does not need to be specified, but can be used if the user has specifically stated that a certain data type must be used for a given element. Valid types are: text, int(x), decimal(x,y), date, datetime, time, char(x), varchar(x). For int(x), the x is the number of digits to display in MariaDB when showing the number. For decimal(x,y), the x is the total number of digits, and y is the number of digits after the decimal point. For char(x) and varchar(x), the x is the maximum number of characters to store.

← Back to the MCP reference