Survey123WebFormOptions

Class

Survey123 web form options.

Inheritance: Survey123WebFormOptionsSurvey123JsApiCommonOptions

Properties

autoRefresh optional
autoRefresh: number

Enable auto-refresh the survey after submit successfully. You can set autoRefresh=3 which will refresh the survey after 3 seconds.

clientId
clientId: string

A valid Client ID for your domain registered on ArcGIS for Developers website.

container
container: any

The HTML element that contains the web form, typically a DIV.

defaultQuestionValue optional
defaultQuestionValue: any

Allows you populate questions in the form. For example:

 
1
{field_0: 'value1', field_1: 'value2'}
globalId optional
globalId: string

globalId parameter. Supported with version ≥ 3.9

hideElements optional
hideElements: string[]

Elements can be set to be hidden, including navbar, theme, header, description, footer and submit. For example:

 
1
["navbar","header","description"]

You can also hide questions within your survey. For example:

 
1
['field: yourQuestionName']
host optional
host: string

Pass the host URL on IE and Edge to send messages to the parent domain.

isDisabledSubmitToFeatureService optional
isDisabledSubmitToFeatureService: boolean

Set this property to true and the web form will not send data to your feature service.

itemId
itemId: string

The ItemId of the web form you want to load.

mode optional
mode: string

Sets the mode of the web form. Valid values are edit, which sets the survey to edit an existing entry rather than create one, and view, which opens an existing entry in read-only mode, and copy, which will create a new web form that is populated with the contents from an existing entry. When setting the mode, the globalId parameter (version ≥ 3.9) or objectId(version ≤ 3.9) parameter must also be provided.

objectId optional
objectId: string

objectId parameter. Supported with version ≤ 3.9

onFormLoaded optional
onFormLoaded: OnFormLoaded

Invokes a callback function when the form is loaded. The callback parameters include:

     
1
2
3
4
5
{
  form: Form;
  contentHeight: number;
  webformVersion?: string;
}
onFormResized optional
onFormResized: OnFormResized

Invokes a callback function when the form is resized.

onFormSubmitted optional
onFormSubmitted: OnFormSubmitted

Invokes a callback function when the form is submitted. The callback parameters include:

   
1
2
3
{
  surveyFeatureSet: SurveyFeatureSet      // includes all submitted responses.
}

For example:

                                                 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
{
surveyFeatureSet: {
 features:[
   {
   attributes:{
     field_0: 'a',
     field_1: 'abc',
     filed_2: 3
     field_3: 1233225500,
     field_4: '12:30',
     field_5: 'a',
     field_6: 'a, b, other',
     filed_7: '123@123.com',
     filed_8: 'www.esri.com',
     field_10: 'b',
     field_11: 'b',
     // repeat question
     field_9: [
           { attributes:{
              field_1: '09:30',
              field_2: 'www.esri.com',
             },
             geometry: {x:, y:, z: },
             attachments: [],
             created:,
             modified:,
             creator:
           },
            { attributes:{
              field_1: '09:30',
              field_2: 'www.esri.com',
             },
             geometry: {x:, y:, z: },
             attachments: [],
             created:,
             modified:,
             creator:
           }
         ]
     ]
   },
   geometry: {x:, y:, z: },
   attachments: [],
   created:,
   modified:,
   creator:
   }
 ]
}
onQuestionValueChanged optional
onQuestionValueChanged: OnQuestionValueChanged

Invokes a callback function when the values in your form change. The callback parameters include:

       
1
2
3
4
5
6
7
{
  field: string;             // question name
  value: any;                // answer for the question name
  path?: string;             // absolute path
  repeatIndex?: number;      // repeatIndex if the question is in a repeat
  formId?: string;           // feature layer id
}
portalUrl optional
portalUrl: string

The URL of your ArcGIS portal. If left empty, defaults to https://www.arcgis.com

token optional
token: string

Required if you work with private surveys.

version optional
version: string

Version lock on a specific version. Specify 'latest' to always use the latest version of the web app, otherwise it will honor the version setting of the survey. For example:

 
1
version: 'latest'
width optional
width: number

Takes a number in pixels. Controls the width of the survey and a value smaller than 660 will be ignored.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.