Hi,
Since latest releases, I’m struggling with a problem in my java script functions.
When a question is left blank in a repeat, in the next repeat, the same question value is shifted from the second to the first repeat.
As you could see in my example, if I left question 3 and 4 blank in my first repeat, the value entered for these questions in the second repeat are attributed to the first when calculated with Java Script…
Any solutions?
Hi @DougBrowning, could you help me on this?
What am I doing wrong?
This is only since the latest release? For me it is somehow logical that the array only receives valid values. Would you expect to have "null" or "none" in those empty positions?
Sorry I do not use javascript in my forms since I work across AGOL orgs. But your fuction does not make much sense to me. I could see that it does not store blanks in an array since it is a different data type.
Lets step back and tell us what you are trying to do and then adjust the code or do it a different way, Are you just trying to show the last values? Use the last repeat values? There is code for that. Or if you are just showing them join works well for me.
Thanks for the quick response Doug,
I've built a JS function to validate responses in a form by comparing answers from many questions within the same repeat. Example:
If you answer the first question, you must answer questions two and three.
The response will also be used to validate the following questions.
If you do not answer the first question you can skip the others or not.
And this for each repeat in my form. That’s why it is so important to have “undefined” value for unanswered questions.
This was perfectly functional in earlier releases.
Is this a bug?
It may handle blanks differently now I do not know.
You may be able to update the code to something more like this
Picking out the values vs just a big array. Hope that helps