Associating url var with a predefined list?




Let’s say I have a list with 2 items:

I would like to pass a url var (k=1) and display the associated value (XXX) in one of my questions. How can I do that?


Thanks for you help!

FYI Solutions I have seen in the help but that do not work in my exact case are:

  • Making one question for XXX and YYY and routing respondent to the correct question base on the value of k
  • Passing directly XXX and YYY in the url var


IS answered
    IS 2.21K Rep.

    You can do this on any page after the first if you have access to Hidden Value fields and custom scripting.

    On the first page, insert a Hidden Value field to hold the translated value of your URL variable.

    At the very top of the second page create a custom script that would be something like:

    %%qid = 5;
    switch (sgapiURLValue(“k”)) {
    case 1:
    sgapisetvalue(%%qid, “XXXX”);
    case 2:
    sgapisetvalue(%%qid, “YYYY”);
    case 3:
    sgapisetvalue(%%qid, “ZZZZ”);
    sgapisetvalue(%%qid, “ERROR”);

    Then where you wanted to show the value use a merge code like: [question(“value”), id=”5″]

    The above assumes that the hidden value has a question ID of 5, but you can change it to match the id of the hidden value you created.

    Note that this forum translates normal quotes to left- and right-quotes. This will cause your script to fail if you copy and paste. You would need to type over all of the quote characters to have a working script.

    IS answered


      Question stats

      • Active
      • Views2546 times
      • Answers1 answer
      • Followers1 follower