In several questions we use the token attributes of the respondent in the question's javascript. For instance:
--javascript being passed to php
var tokenAttribute1 = {TOKEN:ATTRIBUTE_1};
--php script
$sql = "select * from foo WHERE attr='".$tokenAttribute1."'" ;
While testing these questions (lay-out etc) however, we would like some default value for the tokenAttribute1 without going through the survey each time we wish to see some changes. As the {TOKEN:ATTRIBUTE_1} is not set or defined when testing a single question, javascript throws a syntax error. I was wondering whether there is solution along the lines of
this topic in the bugtracker:
where a isset function is proposed. I think the expression manager passes an object or variable back after parsing the attribute, but I do not know how to evaluate this.
Psuedo code would be:
tokenAttribute1 = 0;
if(isset{TOKEN:ATTRIBUTE_1})
{
tokenAttribute1={TOKEN:ATTRIBUTE_1};
}
A similar test could be used in questions relying on answers from previous question - a bit like
this topic
Thanks in advance!