Survey123Webform + setQuestionValue with multiline
We have a survey published from S123Connect with a multi-line textbox. The survey is opened in a Survey123Webform using setQuestionValue and the contents of the textbox are prefilled with text pulled from other data sources.
where this.comments contains:
Test Entry 2\nB7 reports fire completely out.\nb50 reports fire out\nB15 reports that the fire is out.\nB10 reports the fire is out
The earlier version published via S123C 3.9 definitely used to work as expected (multi-line contents displayed without additional encoding values.
displayed correctly as:
Test Entry 2
B7 reports fire completely out.
b50 reports fire out
B15 reports that the fire is out.
B10 reports the fire is out
Now the same function encodeURIComponent(this.comments) when passing the data to the S123 textbox displays as:
I am not sure when this behaviour changed as I have not looked at this specific survey for a while. Is there a workaround to get the linefeeds back into the displayed text?
If the multiline textbox is updated and the data is saved into the underlying feature service and the survey is re-opened in edit mode using globalid as a parameter, the lines are displayed correctly across multiple lines
If you do not use encodeURIComponent then only the first line of the question value appears. This is similar to the behaviour we have noticed with:
Web survey opened from link with field settings using encodeURIComponent
In this scenario the text is cut off after line 1, but we do not see the html encoding characters
*** 2 ****
These warning are also displayed in the log - do we need to change the way the Survey123Form is called and/or update to js api 4.21?
Hi @dstalberg1 ,
Can you try version lock as a workaround?
To complete version lock, two settings needed to be done:
1, Set for web app version lock. Go to website --click on the specific survey--settings--web app versions: use the version the survey was published with;
2, Set for js api version lock. When referencing js api, be specific about version as https://survey123.arcgis.com/api/jsapi/3.xx
Try if this would serve as your workaround.
Thank you for the reply.
I take it that the workaround for the version lock only applies to the issue with the jsapi warning messages?
Do you have any feedback regarding the multiline textbox issue?