خرید بک لینک
Hi all,

I am working on a survey in SSI Sawtooth software, so some of this syntax i.e.
Code:

[% GetValue(tram1) %];
is from SSI Sawtooth.

What I am trying to do is get this question, Q1 to show up if the survey taker has answered yes to just one of the previous fifteen questions, no more, no less, otherwise I want it to be hidden and skip to the next question. So to do this I tried to make an array and sum the values from the fifteen (binary 1 =Yes 0=No) questions.

But Q1 is not showing up even when I have selected one of the previous 15 questions, it does not show up at all with this code. I think my main issue might be inserting the sum variable into the jquery code properly, I've used this display/hide jquery code with other variables and it works.




Code:

<style>
#[% QuestionName() %]_div {display:none}
</style>

<script>
</script>

<script> type="text/javascript">

var T1 = [% GetValue(tram1) %];
var T2 = [%GetValue(tram2) %];
var T3 = [%GetValue(tram3) %];
var T4 = [%GetValue(tram4) %];
var T5 = [%GetValue(tram5) %];
var T6 = [%GetValue(tram6) %];
var T7 = [%GetValue(tram7) %];
var T8 = [%GetValue(tram8) %];
var T9 = [%GetValue(tram9) %];
var T10 = [%GetValue(tram10) %];
var T11 = [%GetValue(tram11) %];
var T12 = [%GetValue(tram12) %];
var T13 = [%GetValue(tram13) %];
var T14 = [%GetValue(tram14) %];
var T15 = [%GetValue(tram15) %];
var sum = T1 + T2 + T3 + T4 + T5 + T6 + T7 + T8 + T9 + T10 + T11 + T12 + T13 + T14 + T15;

$(sum);

setInterval(function () {
    if(document.mainform["sum"] == 1 ) {
                $("#[% QuestionName() %]_div").css('display', 'block');
        }               
        else {
                $("#[% QuestionName() %]_div").css('display', 'none')
        }}, 100);
</script>

Any help would be greatly appreciated, thanks!

برچسب: نویسنده: آیلین رضوانی تاريخ: شنبه 3 تير 1396 ساعت: 1:28

صفحه بندی