Removing bookend quotes from a piped text entry so it can be used as part of a URL query string | XM Community
Question

Removing bookend quotes from a piped text entry so it can be used as part of a URL query string

  • 25 November 2020
  • 1 reply
  • 10 views

Hi,
I have a problem that I can't seem to figure out. Here is the gist:
Participants in my survey are using the "Copy as path" option in Windows to copy the path of a picture file on their machine that I want to append as a query string, which will eventually be used to point them to a Inquisit URL that needs the picture path to display a picture in an experiment. The problem is that when you use the "Copy as path" it includes double quotes at the beginning and end of the path. My intention was just to pipe the response as a query string in my URL and have the participants click on the link. However, when the link is clicked the query string is blank. I assume this is due to the leading quote because when I manually remove the leading double quote everything works fine.
I hesitate to ask participants to remove the quotes manually before submitting their answer because they usually don't read the instructions so I would like to take care of this automatically using Java or some other route. I tried using the custom validation so the participant couldn't submit their entry until the quotes were removed. However, I couldn't seem to figure out how to instruct Qualtrics not to validate the entry if the string contained a double quote. I also tried appending the query string with "?format=urlencode" but then I would have to decode all the encoded characters (e.g., %2F to /) using custom Inquisit code, which, considering the variety of unique paths and names people use, is too much guess work.
Thanks in advance for any suggestions!


1 reply

Userlevel 4
Badge +4

You can use custom validation and set it to "does not contain" double quotes. That way participants can't submit a string that has double quotes.
Javascript might require more thorough handling and character escaping (e.g. different OS, different ways to copy path, escaping single/double quotes and back/forward slashes only where relevant in the path).

Leave a Reply