After the 3.15 update, one of my pulldata JavaScript functions is no longer working. The functions will work if I revert to the old version (published in 3.12). They were also working in 3.14.
This function works as expected (to remove the dot in the AGOL username):
function findandreplace(inStr, findstr, replacestr) {
return inStr.split(findstr).join(replacestr);
}
This function no longer works with the 3.15 update (to capitalize the first letters in the username) :
function capitalized(make){
return make.replace(/(^|[\s-])\S/g, function (match) {
return match.toUpperCase();
});
}
I would also like to note that both of my functions are in the same JavaScript file.
Is anyone else having issues with their JavaScript functions after the 3.15 update? Is there an issue with my second JavaScript function that will no longer work with the 3.15 update?
I appreciate the help and responses.
Thanks!
Carlos
Hello @carlosreyes_dotca,
What is the behavior observed in the web form? I know you mentioned that the function isn't working is it returning an error, not returning anything, or not doing anything?
If possible would you be able to provide a little context as to how both JS functions are being used in the form? I spun up a super simple form that has both functions in the same file and reference the `capitalized` function in my XLSForm but that is working in my testing on the web.
One thing to check is any console errors in the web browser when the JS function triggers or when the form loads.
Hi Zach,
Thank you for getting back to me. The JS function returns nothing, and there are no console errors in the web browser when I load the survey. To give you some background, I am using the JS functions to calculate my users' full names without any dots or lower cases. My Org creates AGOL usernames based on their full names and uses a dot (.) to separate the first and last names, and sometimes the usernames are lowercased (ex. carlos.reyes).
We created a survey that captures the editor's username to know who did the survey, and we wanted the survey to calculate the full name instead of the username. I found some helpful JS functions online to do the calculations. This is the workflow that we created:
I also attached my XLSForm to review and see our workflow.
Please let me know if you need additional information, and thanks again for the help.
Carlos