Select to view content in your preferred language

JavaScript Errors for Resubmissions

234
0
09-01-2022 06:34 AM
HamishPatten
New Contributor

I used the Survey123 Connect app to build my survey. I had to use some bespoke JavaScript functions to extract the labels for the users responses to multi-response dependent drop-down list questions. These are in the form of a calculate field. I also have single-response DDDL questions, and there I was fortunately able to use jr:choice-name(selected-at(...)).

The issue is, once a user has submitted an entry, which I know for sure that they do through the Survey123 Field app and not through the website-hosted survey, when they go through either their Sent or Inbox folder to edit and resubmit their entry, the JavaScript functions are not recalculated. A JavaScript error is produced for all survey questions that used either the bespoke JavaScript or even jr:choice-name(selected-at(...)) functions.

I know that the issue is not solved if we remove user access to either the Sent or the Inbox folder, as I tried both of these and the error pursued. Furthermore, I read online about a mysterious 'Recalculate' button, but this does not appear on my survey, even when I make sure that none of the calculate fields re 'hidden'.

I have tried many different ways to solve this problem, but the errors persist, and I'm entirely fresh out of ideas... please please please could someone let me know if there is a solution to this?

 

I will attach the JavaScript file and the function calling it from the 'calculation' field in the 'survey' sheet of the Survey123 spreadsheet, but I really don't think that this is the problem. These scripts work when submitting, just not when a user resubmits their entry. Note that the user doesn't even have to modify anything in the form for the error to still occur upon resubmission.

The JavaScript is attached, and is called via
if(${formattype_dataset} != "",pulldata("@javascript", "multichoicelabel.js", "mchoicelabel",${formattype_dataset},string('formattypespread;formattypespatial;formattypedocument;formattypewebapp;formattypeother'),string('Spreadsheet;GIS;Document;Website;Other)')),"")

where the first 'string(...)' corresponds to the coded 'name' column in the 'choices' sheet, and the second 'string(...)' corresponds to the 'label' column value for that specific coded name. 

 

0 Kudos
0 Replies