Can I pass hidden values to a JavaScript Action?



I would like to create a JS action in one of my surveys and be able to pass a variable that previously was passed to the survey by URL.

I created the hidden value with name “user_id” and value url[”user_id”]. I pass the variable to the survey like: ?user_id=4
The hidden value gets saved.

In the next page I have a question that will have a small javascript where I need to have this variable  (inside the JS script).

Is it possible to pass this variable somehow?
Best regards!

Juumlrgen Schnatterer238573 asked

    Hi Juum,

    This is a great question that has had me stumped.

    If it were on the first page you might be able to use something like

    My only idea that may/may not work for you – 

    Create a hidden text field on that page and set the default answer to (url[”user_id”]) . Then you can set the question to hide (mainly used for custom scripting) and use javascript/jquery to pull that value so you can use it in your script.

    The only caveat that I am uncertain about is wether that will still render in the html code so you can still pull it. If not, then skip the question hide step and set the CSS to display:none. Then you should be able to use the DOM to pull that value so you can compare it.

    Let me know if this works for you.

    Jacob Hayslett answered


      Question stats

      • Active
      • Views2105 times
      • Answers1 answer
      • Followers0 followers