function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
JCSJCSJCSJCS 

CLICKTOOLS / Javascript

All - I am using a web-based survey solution (Clicktools) to get some info from my clients to be imported into Salesforce. The survey tool enables the passing of "responses" to javascript. The code below is an example of a problem I am having that I can't seem to solve.

The code below takes the input from question 1 in the survey and writes it back out to the browser. The syntax in the survey tool is ${question_1} for question 1, ${question_2} for question 2, etc.

The problem is that if the response to question 1 is a NUMBER, the script below works fine. BUT if the response is TEXT, the javascript does not work. I am guessing the problem is due to the fact that I don't have quotes around the survey tool variable - but I can't because then the variable will not get set properly.

Any suggestions on how to solve this?

<script type="text/javascript">
document.write(${question_1});
</script>

So if Question 1 = 123123 then
123123 is written to my browser.

BUT if Question 1 = HELLOWORLD then
the Javascript does not work!

HELP!

DevAngelDevAngel
You could try using a textarea tag something like

<textarea id="q2" style="display:none">{!question_2}</textarea>

Then you can refer to the text area from js using getElementById