FormItem

FormItem

A FormItem object as defined in the JSON schema

Constructor

new FormItem(props)

Instantiates a new FormItem

Parameters:
Name Type Description
props object

Properties to initialize the form item with

Properties
Name Type Attributes Default Description
type 'string' | 'date' | 'datetime' | 'int' | 'float' | 'hidden' | 'form-menu' | 'email' | 'url' | 'location' | 'range' | 'regex' | 'tel' | 'phone' | 'textarea' | 'login' | 'logout'

Sets FormItem#type

name string

Sets FormItem#name

description string <optional>

Sets FormItem#description

header string <optional>

Sets FormItem#header

footer string <optional>

Sets FormItem#footer

body Array.<MenuItemFormItem> <optional>

Sets FormItem#body

value string <optional>

Sets FormItem#value

chunkingFooter string <optional>

Sets FormItem#chunkingFooter

confirmationLabel string <optional>

Sets FormItem#confirmationLabel

minLength number <optional>

Sets FormItem#minLength. It must be integer.

minLengthError string <optional>

Sets FormItem#minLengthError

maxLength number <optional>

Sets FormItem#maxLength. It must be integer.

maxLengthError string <optional>

Sets FormItem#maxLengthError

minValue number <optional>

Sets FormItem#minValue

minValueError string <optional>

Sets FormItem#minValueError

maxValue number <optional>

Sets FormItem#maxValue

maxValueError string <optional>

Sets FormItem#maxValueError

step number <optional>

Sets FormItem#step

meta MenuFormItemMeta <optional>

Sets FormItem#meta

method string <optional>

Sets FormItem#method

onLoginFailure string <optional>

Sets FormItem#onLoginFailure

onLoginSuccess string <optional>

Sets FormItem#onLoginSuccess

onLogoutFailure string <optional>

Sets FormItem#onLogoutFailure

onLogoutSuccess string <optional>

Sets FormItem#onLogoutSuccess

required boolean <optional>
false

Sets FormItem#required

default string <optional>

Sets FormItem#default

pattern string <optional>

Sets FormItem#pattern

statusExclude boolean <optional>
false

Sets FormItem#statusExclude

statusPrepend boolean <optional>
false

Sets FormItem#statusPrepend

url string <optional>

Sets FormItem#url

validateTypeError string <optional>

Sets FormItem#validateTypeError

validateTypeErrorFooter string <optional>

Sets FormItem#validateTypeErrorFooter

validateUrl string <optional>

Sets FormItem#validateUrl

Source:

Members

body :Array.<MenuItemFormItem>

Composed of MenuItemFormItem objects
required only for type=form-menu.

Source:

chunkingFooter :string

Shown in the footer of the sms chunks.

Source:

confirmationLabel :string

Shown in the confirmation menu.

Source:

default :string

A default value in case of non required form items

Source:

description :string

The description of this FormItem.

Source:

If provided will overwrite the Form#footer.

Source:

If provided will overwrite the Form#header.

Source:

maxLength :number

Validates the user input
applies only for type=string.

Source:

maxLengthError :string

Message to be shown on maxLength error.

Source:

maxValue :number

Validates the user input
applies only for type=int|float.

Source:

maxValueError :string

Message to be shown on maxValue error.

Source:

meta :MenuFormItemMeta

MenuFormItemMeta object
applies only for type=form-menu.

Source:

method :string

HTTP method, how the callback url should be triggered.

Source:

minLength :number

Validates the user input
applies only for type=string.

Source:

minLengthError :string

Message to be shown on minLength error.

Source:

minValue :number

Validates the user input
applies only for type=int|float.

Source:

minValueError :string

Message to be shown on minValue error.

Source:

name :string

The name of this FormItem, used in form serialization.

Source:

onLoginFailure :string

Optional path to redirect on login failure, valid when type='login'

Source:

onLoginSuccess :string

Optional path to redirect on login success, valid when type='login'

Source:

onLogoutFailure :string

Optional path to redirect on logout failure, valid when type='logout'

Source:

onLogoutSuccess :string

Optional path to redirect on logout success, valid when type='logout'

Source:

pattern :string|null

ECMA Script regex pattern string
applies only for type=regex.

Source:

required :boolean

User can SKIP this FormItem if set to false

Default Value:
  • false
Source:

statusExclude :boolean

If true this step will be excluded from the form completion status.

Default Value:
  • false
Source:

statusPrepend :boolean

If true this step will be prepended to the body of the response. Appended otherwise.

Default Value:
  • false
Source:

step :number

specifies the legal number intervals for input field

Source:

type :string

Indicates the type of the object.

Source:

url :string

Callback url triggered right after the choice has been set for this form item.

Source:

validateTypeError :string

An error message to be shown on basic type validation.

Source:

validateTypeErrorFooter :string

Shown in the error message footer.

Source:

validateUrl :string

The callback url path "GET" triggered to validate user input.
A query string is sent by ONEm: ?form_item_name=user_input
The validate_url must return a json response: {"valid": true/false, "error": "Some message in case of validation errors"}.

Source:

value :string

Value to pass in the form serialization data _.

Source:

Methods

(static) fromTag(sectionTag) → {FormItem}

Creates a FormItem from a SectionTag

Parameters:
Name Type Description
sectionTag SectionTag
Source: