Field types
Field types are different kinds of question formats that a user can assign to a form. The type
section controls how the questions are formatted in the UI as well as the types of responses that are expected or required.
Available formats include:
hidden
– No field will be shown in the UI, but the value will be stored in the form.string
– A textbox will be shown in the UI to capture the answer, and the answer will be formatted to a string.clob
– A text area will be shown in the UI to capture the answer, and the answer will be formatted to a multiline string.email
– Behaves just like astring
type, but with e-mail address validation.password
– A password style of textbox will be shown in the UI to capture the answer, and the value will be dotted and formatted to a string.url
– Behaves just like astring
type, but with the URL validation.boolean
– A checkbox will be shown in the UI to capture the answer, and the answer will be entered astrue
if the checkbox is selected orfalse
otherwise.enum
– A dropdown menu will be shown in the UI and theoptions
section will be populated in the menu. Themultiple
option set totrue
will enable a multiple choice type of a drop-down, while theexpanded
option set totrue
will change the dropdown into a radio button group.color
– A color picker will be shown in the UI to capture the answer, and the answer will be formatted to the string with a#
sign at the beginning.date
– A date picker will be shown in the UI to capture the answer, and the value will be formatted to the string.tel
– Behaves just like astring
type, but with telephone number validation (ie. digits and dashes).datetime
– A date-time picker will be shown in the UI to capture the answer, and the value will be formatted to the string.time
– A time picker will be shown in the UI to capture the answer, and the value will be formatted to the string.integer
– A number picker will be shown in the UI to capture the answer, and the value will be validated to confirm if it is an integer.money
– Behaves just like astring
type but with number validation and a$
sign that precedes the textbox.number
– Behaves just like astring
type but with number validation.percent
– Behaves just like astring
type but with number validation and a%
sign that follows the textbox.
Here's an example of a complete Buildspec with field types:
form:
- id: secretToken
type: hidden
hideLabel: true
- id: name
type: string
label: My Name
description: Test description for the name field
required: true
autofocus: true
- id: description
type: clob
label: Description
description: Test description for the description field
required: false
- id: email
type: email
label: Email
description: Give me your email so that I may spam you
required: true
- id: password
type: password
label: Password
description: I want access to all your data
required: false
- id: website
type: url
label: Web site
description: What is your website?
- id: blahEnabled
type: boolean
label: Blah Enabled?
- id: favoriteFood
type: enum
placeholder: -- Please choose one --
options:
expanded: false
multiple: false
choices:
American: american
Chinese: chinese
French: french
German: german
Italian: italian
Japanese: japanese
Korean: korean
Other: other
Polish: polish
label: Favorite Food
description: What's your favorite type of food?
required: true
- id: favoriteColor
type: color
label: Favorite Color
description: What's your favorite color?
- id: dob
type: date
label: Date of Birth
description: When did you awake from the eternal sleep?
- id: homePhone
type: tel
label: Home Phone
description: >
I need your home phone so that I can sell this to robocall
companies.
placeholder: ex. 555-555-1234
- id: expiration
type: datetime
label: Expiration Date
description: >
I'm not sure what is expiring but at least
tell me when it should.
placeholder: yyyy-MM-dd HH:mm:ss
- id: bestTime
type: time
label: Best Time
description: >
What time of the day is the "best time"?
- id: numCars
type: integer
label: Number of Cars
description: >
Tell me how many cars you own so I can sell
this information to auto dealers.
placeholder: ex. 2
- id: salary
type: money
label: Annual Salary
description: >
Tell me your salary so can I sell this
information to sleeze finance types.
- id: randomNumber
type: number
label: Random Number
description: >
Pick a number game. Can you guess it?
You won't win anything regardless.
- id: testPct
type: percent
label: Chance of Escape
description: >
What do you think your chances are of
getting out alive? (creepy)