Hi
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.
survey123WebForm.setQuestionValue({
comments: encodeURIComponent(this.comments),
});
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
https://survey123.arcgis.com/share/xxxxitemidxxxxx?portalUrl=https://domain.com/portal&open=web&fiel...These%20are%20the%20notes%20for%20this%20survey.There%20is%20more%20than%20one%20line%20of%20text&field:jobid=469&field:moduleid=1&field:location=8793%20Plein%20Street
In this scenario the text is cut off after line 1, but we do not see the html encoding characters
Hi @Dawn ,
Can you share a copy of setQuestionValue script? It does not have to be a whole copy, as long as it contains basic lines to reproduce your issue.
Regards,
Alison
Thanks Alison
*** 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.
Regards,
Alison
Hi Alison
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?
Thank you
Regards
Dawn
Hi
The version lock is for the multiline textbox issue, please have a try.
Hi @Dawn
We have an undergoing issue to support line break both in js api and url parameters.
The version lock is workaround for line break in js api.
Regards,
Alison