Survey123 is still logging our users out approximately on a weekly basis I've heard. When this happens, the username field is not populated and users can't submit their surveys because its a required field.
As a workaround, I have a text input appear when the username is not present.
My survey looks like this:
type | name | label | calculation | relevant | Explanation |
---|---|---|---|---|---|
text | inspector | Inspector | ${username} | ${username} = '' | If user isn't signed in, let them enter a username so the survey still submits |
username | username | username | Try and auto populate the username variable | ||
label | InspectionMeta | Inspection | concat("Inspector: ", ${inspector}) | Display the username to the user so they know they are signed in. |
BUT this breaks the label. Inspector is never displayed to the user.
Solved! Go to Solution.
When there is a username inspector hides - which causes it to go to "". Whenever any field hides due to the relevant it will always blank the field (it does NOT just hide it but sets it to empty string). So above when there is a username the field hides - which overrides the calculation and blanks it.
Remove the calculation from inspector
Use an if in the label.
if( ${username} = '', concat("Inspector: ", ${inspector}), concat("Inspector: ", ${username}))
When there is a username inspector hides - which causes it to go to "". Whenever any field hides due to the relevant it will always blank the field (it does NOT just hide it but sets it to empty string). So above when there is a username the field hides - which overrides the calculation and blanks it.
Remove the calculation from inspector
Use an if in the label.
if( ${username} = '', concat("Inspector: ", ${inspector}), concat("Inspector: ", ${username}))
That works! Thanks Doug!