field
Last updated
Last updated
The following options can be specified for a field
tag:
Name | Required | Details |
---|---|---|
The following can be placed inside a field
tag:
Nested Element | Details |
---|---|
Fields in your Data Model and variables in your Views are set up to store a specific kind of data — which can be any of the following:
integer
Can accurately represent numbers between -231 and 231-1 (-2 147 483 648 and 2 147 483 647).
Example: 100
number
Uses JavaScript's implementation of IEEE 754 and therefore supports MAX/MIN values of Number.MAX_VALUE => 1.7976931348623157e+308
Number.MIN_VALUE => 5e-324
Example: 3.14
text
Text value - anything from a short name to longer paragraphs. Some subtypes are defined for text values, which affect the input method shown to the user on a mobile device, and may provide additional validations. Please refer to the Text Subtypes section below.
Example: "John Doe"
date
Represents a date in the Gregorian calendar, for example "2016/10/27". Not tied to any timezone.
Example: 2016/10/27
datetime
Represents a specific date & time combination. Time is always displayed in the local timezone. For example, "2016/10/27 12:15:48" in UTC will be displayed as "2016/10/27 14:15:48" on a device configured for GMT+2.
Example: 2016/10/27 12:15:48
location
Represents a set of GPS coordinates. This includes:
latitude
longitude
altitude
horizontal_accuracy
vertical_accuracy
timestamp
Limitation
Capturing the altitude
and/or vertical_accuracy
is not supported on several platforms / devices, including Android devices. These devices will return undefined
or null
for these fields.
Example:
single-choice
Represents a single choice from a list of options, for example "gender" or "province". Options are specified as a list of string key and label pairs.
When accessed from JavaScript/TypeScript, the key is used.
When displaying the value to a user, the human-readable label is used.
Example options:
For the example, if the "Female" option was selected, the value when accessed from your JavaScript/TypeScript code would be "female"
.
single-choice-integer
Represents a single choice from a list of options, for example "gender" or "province". Options are specified as a list of integer key and label pairs.
When accessed from JavaScript/TypeScript, the integer key is used.
When displaying the value to a user, the human-readable label is used.
If the keys are not explicitly defined, they start counting from 0 and increment by one for each option.
Example options:
For the example, if the "Female" option was selected, the value when accessed from your JavaScript/TypeScript code would be: 1
.
boolean
Represents a single choice from two boolean options, for example "Checked" or "Not Checked". Options are specified as two list of boolean key and label pairs, defaulting to "Yes" (true) and "No" (false).
When accessed from JavaScript/TypeScript, the boolean key is used.
When displaying the value to a user, the human-readable label is used.
Example options:
For the example, if the "Not Checked" option was selected, the value when accessed from your JavaScript/TypeScript code would be: false
.
multiple-choice
Same as a single-choice
field, but multiple values may be selected.
When you access a multiple-choice value from JavaScript/TypeScript, the value will be an array of keys of all the selected options.
Example options:
For the example, if the first two options were selected, the value when accessed from your JavaScript/TypeScript code would be: ["checked-oil", "checked-tyre-pressure"]
multiple-choice-integer
Same as the single-choice-integer
field, but multiple values may be selected.
When you access a multiple-choice-integer value from JavaScript/TypeScript, the value will be an array of integer keys of all the selected options.
Example options:
For the example, if the first two options were selected, the value when accessed from your JavaScript/TypeScript code would be:
[0, 1]
photo
Represents a photo file, captured as a JPEG image by the mobile application.
signature
Represents a signature file, captured as a 400x200px SVG file by the mobile application.
track
Represents a recorded GPS tracking session. Data can be displayed on a map in the App Backend or exported to GeoJSON, GPX or KML.
attachment
Variable for capturing files. Must include a media attribute with one of the following types:
any
image/jpeg
image/png
image/svg+xml
application/pdf
application/vnd.openxmlformats-officedocument.presentationml.presentation
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
application/vnd.openxmlformats-officedocument.wordprocessingml.document
application/vnd.ms-excel
application/vnd.valvelink
(Maps to .exp
files. Introduced in JourneyApps Runtime version 4.90.0)
application/msword
text/plain
text/csv
application/xml
application/vnd.anritsu
For example:
As discussed above, some subtypes are defined for text types, which affect the input method shown to the user on a mobile device, and may provide additional validations.
To use one of these subtypes, add :subtype to a text field definition, for example:
Subtype | Details | Additional validation? |
---|---|---|
name
required
Identifier for this field, unique per model. Used anywhere that code needs to reference the object.
label
required
Human-readable label for this field. Used wherever it is displayed to a user.
type
required
The type of this field. See the section below for the possible types.
option
Applicable to choice types. Specifies a single option key and label.
(none)
The default - any characters are allowed.
No
text:email
Email address.
Yes. Validates whether the entered value is a valid email address.
text:address
Street address, suburb or city. Words are automatically capitalized.
No
text:name
Person or other name. Words are automatically capitalized.
No
text:url
Web URL.
No
text:paragraph
A multi-line block of text. Renders as a paragraph rather than as a single line.
No
text:number
Only digits are allowed.
No
text:signed-number
Digits are allowed, as well as a negative sign.
Yes. Validates whether the entered value is a valid signed number.
text:phone-number
Represents a phone number. Only digits are allowed.
Yes. Validates whether the entered value is a valid phone number.
text:decimal-number
Digits are allowed, as well as a decimal point and negative sign.
No
text:password
Characters are hidden when entered.
No