Select to view content in your preferred language

Recalculate parameter in Survey123 Web App JavaScript API?

987
1
Jump to solution
08-11-2023 03:20 PM
JRhodes
Frequent Contributor

I've made a custom Survey123 form using the Web App JavaScript API, which works great. However, I need to submit the form request while passing field names to the recalculate parameter, and I don't see this property in the documentation for the Survey123WebFormOptions class.

I can set mode, portalURL, version, etc. through the API, but not recalculate. Does anyone know if this is possible without modifying and self-hosting the API code?

Tags (2)
1 Solution

Accepted Solutions
JRhodes
Frequent Contributor

For now, we're just going to modify the API code and self-host. In case anyone needs to have access to this parameter (or any other web form URL parameter not available in the Survey123WebFormOptions class), you can add:

const qqq = this.recalculate;
qqq && (t.recalculate = qqq);

 

to the getUrlQueryString() function of the Web Form API, then add a recalculate parameter to the web form instance in index.html, like so:

const webform = new Survey123WebForm({
        clientId: 'uWqBqfybE4SWiQJL',
        container: 'formDiv',
        portalUrl: 'https://gis.example.com/portal',
        mode: 'edit',
        globalId: globalid,
        itemId: '5780e99999904bb9b981b7a99999999',
        recalculate: 'field:Reinspect_Status,field:Scenario_Types,field:Scenario_Components',

 

@JamesTedrick: We'd love to see this available in a future version of the web form API, if possible!

View solution in original post

0 Kudos
1 Reply
JRhodes
Frequent Contributor

For now, we're just going to modify the API code and self-host. In case anyone needs to have access to this parameter (or any other web form URL parameter not available in the Survey123WebFormOptions class), you can add:

const qqq = this.recalculate;
qqq && (t.recalculate = qqq);

 

to the getUrlQueryString() function of the Web Form API, then add a recalculate parameter to the web form instance in index.html, like so:

const webform = new Survey123WebForm({
        clientId: 'uWqBqfybE4SWiQJL',
        container: 'formDiv',
        portalUrl: 'https://gis.example.com/portal',
        mode: 'edit',
        globalId: globalid,
        itemId: '5780e99999904bb9b981b7a99999999',
        recalculate: 'field:Reinspect_Status,field:Scenario_Types,field:Scenario_Components',

 

@JamesTedrick: We'd love to see this available in a future version of the web form API, if possible!

0 Kudos