[Solved] Skip/autosubmit page if question is hidden

0

Hi there!

I am hiding a question with the following JavaScript-Code which is on the same page.

 

$(document).ready(function(){
 
  $(“.p23”).hide();
 
  var consum1 = ‘[question(“value”), id=”69″]’*1;
  var consum2 = ‘[question(“value”), id=”73″]’*1;
  var consum3 = ‘[question(“value”), id=”74″]’*1;
  var consum4 = ‘[question(“value”), id=”75″]’*1;
 
  if (consum2 > consum1 && consum2 > consum3 && consum2 > consum4){
    $(“.p23”).show();
  }
  });

How can I skip or autosubmit this page if the question is hidden?
Is there something like “if hidden than sgapiJumpToPage(%%next_page_id);”?

Best regards,
Christian

Christian selected answer

    Best answer

    0

    CustomScript:

    sgapiHidePage(23,true);

        %%consum1 = sgapiGetValue(69);
        %%consum2 = sgapiGetValue(73);
        %%consum3 = sgapiGetValue(74);
        %%consum4 = sgapiGetValue(75);

        if (%%consum2 > %%consum1 && %%consum2 > %%consum3 && %%consum2 > %%consum4)
        {
            sgapiHidePage(23,false);
        }

    Christian selected as best answer
      0

      Question – are there other questions on the page, or just the script and the question (q71)?

      If q71 is on its own page, my group would probably place the script on an admin page, and then use the sgapiHidePage function to hide or unhide the page with q71 on it as needed (a hidden page will be skipped and will never be seen by the respondent).  We would also use custom scripting for this rather than JavaScript.

      Christian commented
        ×

        Login

        Question stats

        • Active
        • Views149 times
        • Answers2 answers
        • Followers1 follower