Hidden (Free Format Variable)
Top  Previous  Next

This is an advanced area for declaring a hidden variable using JavaScript and setting its value.



Example #1:
Setting the hidden variable equal to a random number used in the survey.

Suppose you declared a random value earlier in the survey (such as "RandNum(53)") and wanted to store the value of that random number in your data set.

1. Add a Free Format question to your survey, and a variable (e.g. myvar1_rand) of type hidden.  
2. Edit the HTML (using the "pencil" icon pencil, and using the Free Format Tools button tools select myvar1_1 from the drop-down control list, to insert the following text in your HTML:  
 
<input name="myvar1_rand" type="hidden">  
 
Then, edit that text to assign the value equal to the function RandNum(53):  
 
<input name="myvar1_rand" type="hidden" value="[%RandNum(53)%]">  
 



Example #2:
Setting the hidden variable equal to the sum of two numeric variables on a previous screen. Assume the two previous numeric variables were Value1 and Value2.

1. Add a Free Format question to your survey, and a variable (myvar1_sum) of type hidden.  
2. Edit the HTML (using the "pencil" icon pencil, and select the Free Format Tools button tools to insert the following text in your HTML:  
 
<input name="myvar1_sum" type="hidden" value="[%Q1+Q2%]">