JavaScript not working when editing existing data in Survey123 web

114
2
a month ago
AhjungKimSTN
New Contributor II

My form has a field that is automatically filled by a JavaScript function. 

- A date question is answered.

- The following question gets filled IF the previous date field is not null. 

This works in the mobile form and the web form when creating new features.  However, when we open the same form in the web browser to edit existing data the function does not work.  Nothing happens when the date question is answered. 

Is this a known limitation? I read the limitations in the Esri doc but this particular case was not mentioned.  My form is secured and does not have repeats.  

AhjungKimSTN_1-1631803655439.png

 

0 Kudos
2 Replies
Alber_Verster
Esri Contributor

Hi,

You seem to have met all the requirements that would allow the function to work properly so I believe your problem has to do with the fact that the function is not firing when editing an existing feature. The relevancy constraint would also affect the function so my suggestion would be to add a "calculate" field from which you can run the Javascript function that always fires and create a "Note" field (for non-editable values) that get's populated by the calculate field's value when the constraints are met.

If the above it a little confusing then please share your xlsx design for me to have a closer look.

Regards,

Alber 

0 Kudos
DeonLengton
Esri Contributor

Hi Kim

It is a known limitation when using the Inbox and Calculations - since a field has a value coming from the Inbox, Survey123 wont try to overwrite that value.

Please have a look at this discussion for more information and a possible solution:

https://community.esri.com/t5/arcgis-survey123-questions/using-calculations-to-prepopulate-answers-w...

 

0 Kudos