Select to view content in your preferred language

Prevent new line (CR) in text question?

576
2
01-20-2022 12:26 PM
Soper_Chuck
Occasional Contributor

Is there a way to prevent new line characters in a text question? The results of my survey are eventually placed in a pipe-separated text file. Having new lines (or CRLFs) in a delimited text file really messes things up.

I thought using an input filter or possibly changing the keyboard to hide the return key.

Thanks.

Tags (2)
0 Kudos
2 Replies
jcarlson
MVP Esteemed Contributor

You could have the question users see be a dummy question, then have the real question be hidden and calculated with an expression that strips all newline characters out of the dummy question.

Looking at the list of S123 formulas, I think you'll need to resort to a custom JS function to do this.

- Josh Carlson
Kendall County GIS
0 Kudos
Soper_Chuck
Occasional Contributor

Thanks for the suggestion. After I posted my question, I started thinking that a custom JavaScript function might be the only way. Fortunately, I've written a couple of JS functions in Survey123.

Looking at the Survey123 formulas, I noticed regex(). I think that it may work to remove CR and LF characters from the input. I'd also like to remove leading and trailing spaces. I need to review regular expressions. It might be easier to write a JS function.

0 Kudos