Add “Back” button on CAWI and CATI

Compatibility:IdSurvey 6IdSurvey 7

This javascript can be used to add a “Back” button to go back to the last page displayed (following the correct questionnaire flow and skipping unanswered questions). The button will be aligned to the standard “Next” button.

The script has to be set as global script. It’s compatible with CATI and CAWI.

Instructions

In the survey Settings select the “Advanced” tab. Click on “Edit script” and paste the code in the editor.

Click on “OK” to go exit the editor and save the editing.

<script>
     
  
  $(document).on("core.pageRendered",function(){
  var pathname = window.location.pathname; // Returns path only
 $("#prevButtonPage").remove();
      var input = $("<button id='prevButtonPage' class='btn btn-success btn-large btn-block button-next-page'>Back</button>");
  
      input.appendTo("#footer");
  
    $("#footer").addClass("buttonAdded");
    
      $("#prevButtonPage").on("click",function(){
          $("#testmodePageLastAnswered").trigger("click");
        });
  });
  
    
  </script>