14.1. General

This page describes the syntax of «form.json» file which is a part of NextGIS Formbuilder project file (with «.ngfp» extension). The file uses the JSON specification rules and is encoded in UTF-8.

14.2. Syntax

14.3. Elements

OPTIONS Button

Keyname: button

Request JSON Object:
 
  • field (string) – The name of the layer’s field to which this element saves its value. Note: can be null if there was no field selected.
  • text (string) – Text which is displayed as button caption. Can be void string.
  • value (string) – Text which is saved when user presses the button. Can be void string.

Example

{
    "attributes" : {
       "field" : "comment",
       "text" : "Press me",
       "value" : "Magic button was pressed"
    },
    "type" : "button"
}
OPTIONS Checkbox

Keyname: checkbox

Request JSON Object:
 
  • field (string) – The name of the layer’s field to which this element saves its value. Note: can be null if there was no field selected.
  • init_value (bool) – Initial value.
  • last (bool) – Whether to keep value for further sessions of data collection.
  • text (string) – Text which displays near the box of this checkbox. Can be void string.

Example

{
  "attributes" : {
     "field" : "voice_desc",
     "init_value" : false,
     "last" : false,
     "text" : "Have voice description"
  },
  "type" : "checkbox"
}
OPTIONS Combobox

Keyname: combobox

Request JSON Object:
 
  • allow_adding_values (bool) – Whether to allow user to add own items to this combobox during data collection.
  • field (string) – The name of the layer’s field to which this element saves its value. Note: can be null if there was no field selected.
  • input_search (bool) – Whether to show all corresponding items from this combobox at the time when user types some text.
  • last (bool) – Whether to keep value for further sessions of data collection.
  • ngw_id (int) – The NGW resource identifier for the NGW lookup table or -1 if this combobox has no such connection. Note: all other NextGIS Web connection parameters are stored in «meta.json» file.
  • values (array) – The list of items for this combobox. An array of JSON objects where each one has two (or three) pairs of name-values. See below.
  • alias (string) – Alias (displayed value) for the item. Can not be void string.
  • name (string) – Name (inner value) for the item. Can not be void string.
  • default (bool) – Whether this item is showed as default one before user enters this combobox. The value is always true.

Example

{
  "attributes" : {
     "allow_adding_values" : false,
     "field" : "tree_type",
     "input_search" : false,
     "last" : true,
     "ngw_id" : -1,
     "values" : [
        {
           "alias" : "Pine tree",
           "name" : "1"
        },
        {
           "alias" : "Oak tree",
           "default": true,
           "name" : "2"
        },
        {
           "alias" : "Olive tree",
           "name" : "3"
        }
     ]
  },
  "type" : "combobox"
}
OPTIONS Coordinates

Keyname: coordinates

Request JSON Object:
 
  • crs (int) – Coordinate Reference System. Currently always = 0 which refers to «EPSG:4326» (WGS 84).
  • field_lat (string) – The name of the layer’s field to which this element saves its latitude value. Note: can be null if there was no field selected.
  • field_long (string) – The name of the layer’s field to which this element saves its longitude value. Note: can be null if there was no field selected.
  • format (int) – Format of the string. Currently always = 0 which refers to «dd.dddddd».
  • hidden (bool) – Whether this element will not be shown to user on the mobile device.

Example

{
  "attributes" : {
     "crs" : 0,
     "field_lat" : "lat_str",
     "field_long" : "lon_str",
     "format" : 0,
     "hidden" : false
  },
  "type" : "coordinates"
}
OPTIONS Counter

Keyname: counter

Request JSON Object:
 
  • field (string) – The name of the layer’s field to which this element saves its value. Note: can be null if there was no field selected.
  • increment (int) – The value which is added to the current value each session of data collection. Range: from 1 to 65535.
  • init_value (int) – Initial value from which incrementing starts. Range: from 0 to 65535.
  • prefix (string) – Text string to add before the current counter’s number. Can be void string.
  • suffix (string) – Text string to add after the current counter’s number. Can be void string.

Example

{
  "attributes" : {
     "field" : "id_collector",
     "increment" : 1,
     "init_value" : 0,
     "prefix" : "XX",
     "suffix" : "NV"
  },
  "type" : "counter"
}
OPTIONS Date and Time

Keyname: date_time

Request JSON Object:
 
  • date_type (int) – What to save for this date-time element. Possible types: 1) 1 for date, 2) 2 for time, 3) 3 for date and time.
  • datetime (string) –

    Initial value for this date-time element. The string with date is always written in the specific format. Possible formats (according to types):

    1. yyyy-MM-dd,
    2. HH:mm:ss,
    3. yyyy-MM-dd HH:mm:ss.
    Note: can be null which means that the current
    date/time/date-time will be written on the mobile device.
  • field (string) – The name of the layer’s field to which this element saves its value. Note: can be null if there was no field selected.
  • last (bool) – Whether to keep value for further sessions of data collection.

Example

{
  "attributes" : {
     "date_type" : 1,
     "datetime" : "2016-01-01 15:00:00",
     "field" : "time",
     "last" : false
  },
  "type" : "date_time"
}
OPTIONS Double combobox

Keyname: double_combobox

Request JSON Object:
 
  • field_level1 (string) – The name of the layer’s field to which the first (main) combobox saves its value. Note: can be null if there was no field selected.
  • field_level2 (string) – The name of the layer’s field to which the second (dependant) combobox saves its value. Note: can be null if there was no field selected.
  • last (bool) – Whether to keep values for further sessions of data collection.
  • values (array) – The list of items for the first (main) combobox. An array of JSON objects where each one has three (or four) pairs of name-values. See below. Note: if user had not defined any items for the first (main) combobox - the stub item is pasted with «alias»:»–» and «name»:»-1».
  • alias (string) – Alias (displayed value) for the item.
  • name (string) – Name (inner value) for the item.
  • default (bool) – Whether this item is showed as default one before user enters the first (main) combobox. The value is always true.
  • values – The list of items for the second (dependant) combobox. An array of JSON objects where each one has two (or three) pairs of name-values. See below.
  • alias – Alias (displayed value) for the item.
  • name – Name (inner value) for the item.
  • default – Whether this item is showed as default one before user enters the second (dependant) combobox. The value is always true.

Example

{
  "attributes" : {
     "field_level1" : "state",
     "field_level2" : "city",
     "last" : true,
     "values" : [
        {
           "alias" : "California",
           "name" : "CA",
           "values" : [
              {
                 "alias" : "Los Angeles",
                 "name" : "1"
              },
              {
                 "alias" : "San Francisco",
                 "name" : "2"
              },
              {
                 "alias" : "Sacramento",
                 "default" : true,
                 "name" : "3"
              }
           ]
        },
        {
           "alias" : "New York",
           "name" : "NY",
           "values" : [
              {
                 "alias" : "Albany",
                 "default" : true,
                 "name" : "4"
              },
              {
                 "alias" : "New York",
                 "name" : "5"
              }
           ]
        },
        {
           "alias" : "Oregon",
           "name" : "OR",
           "values" : [
              {
                 "alias" : "--",
                 "name" : "-1"
              }
           ]
        }
     ]
  },
  "type" : "double_combobox"
}
OPTIONS Photo

Keyname: photo

Request JSON Object:
 
  • gallery_size (int) – The maximum amount of photos user can make. Range: from 1 to 5.

Example

{
  "attributes" : {
     "gallery_size" : 1
  },
  "type" : "photo"
}
OPTIONS Radiogroup

Keyname: radio_group

Request JSON Object:
 
  • field (string) – The name of the layer’s field to which this element saves its value. Note: can be null if there was no field selected.
  • last (bool) – Whether to keep value for further sessions of data collection.
  • values (array) – The list of items for this combobox. An array of JSON objects where each one has two (or three) pairs of name-values. See below. Note: the array must have at least two items and one of them is always default.
  • alias (string) – Alias (displayed value) for the item. Can not be void string.
  • name (string) – Name (inner value) for the item. Can not be void string.
  • default (bool) – Whether this item is showed as default one before user enters this combobox. The value is always true.

Example

{
  "attributes" : {
     "field" : "tree_type",
     "last" : false,
     "values" : [
        {
           "alias" : "Pine tree",
           "default" : true,
           "name" : "1"
        },
        {
           "alias" : "Oak tree",
           "name" : "2"
        }
     ]
  },
  "type" : "radio_group"
}
OPTIONS Signature

Keyname: signature

Example

{
  "attributes" : null,
  "type" : "signature"
}
OPTIONS Space

Keyname: space

Example

{
  "attributes" : null,
  "type" : "space"
}
OPTIONS Text

Keyname: text_label

Request JSON Object:
 
  • text (string) – Text which displays in this text label. Can be void string.

Example

{
  "attributes" : {
     "text" : "Biotope"
  },
  "type" : "text_label"
}
OPTIONS Text edit

Keyname: text_edit

Request JSON Object:
 
  • field (string) – The name of the layer’s field to which this element saves its value. Note: can be null if there was no field selected.
  • last (bool) – Whether to keep value for further sessions of data collection.
  • max_string_count (int) – How much strings (not symbols!) can be entered to this text edit. Range: from 1 to 65535.
  • ngw_login (bool) – Whether to replace the value of this text edit with NGW login.
  • only_figures (bool) – Whether to allow only numbers for user input to this text edit.
  • text (string) – Initial text which displays in this text edit before user enters it. Can be void string.

Example

{
  "attributes" : {
     "field" : "researcher",
     "last" : true,
     "max_string_count" : 1,
     "ngw_login" : false,
     "only_figures" : false,
     "text" : "Researcher"
  },
  "type" : "text_edit"
}