Target a Specific Page with the Back Button

Important Update to Custom Scripting

SurveyGizmo's CustomScript Action now supports the LUA programming language. Visit our NEW Lua Scripting Resources!

Legacy Custom Scripting Language Deprecation Plans 

  1. New accounts (created after October 29, 2018) will only have the option to use Lua in scripts.
  2. As of October 29, 2018 Custom Scripting Actions will default to Lua as the scripting type in the Custom Scripting Action for accounts created before this date. You will be able to switch to the Legacy Custom Scripting; though we highly encourage using Lua.
  3. In the long term, Legacy Custom Scripting Actions will be switched to read-only. The exact date on this is to be determined; we will send notifications well ahead of time.

In support we get asked if we can have the back button target a specific page. Though this is not a built-in feature, we do have a script for that! In our survey below if you click the back button you will be sent to the Thank You Page. 

Check it out in an example survey.

OR

Add a survey with this setup to your account!

Setup

On the page(s) you'd like this to happen click Add New Action > JavaScript and paste the code below. 

//Set this variable to Page ID that the back button will be sending to.
var pageID = 1;

$(document).ready(function(){
$('.sg-back-button').attr("onclick","$('sg_navchoice').value='sGizmoBackButton';this.form.action=this.form.action+'?__sgtarget="+pageID+ "&';return(true);");
});

Required Customization

The only modification you'll need to make is to change var pageID = 1 to the page ID you'd like the respondent to jump to. For more information on question, page and option ids check out our tutorial on How to Find Ids.

Then do some testing. Go through your survey and see if your back button redirects to the correct page. If for any reason it doesn't, check your page IDs. 

Scripting and Other Custom Solutions

We’re always happy to help you debug any documented script that is used as is. That said, we do not have the resources to write scripts on demand or to debug a customized script.

If you have customization ideas that you haven't figured out how to tackle, we're happy to be a sounding board for SurveyGizmo features and functionality ideas that might meet your customization. Beyond this, you might want to consult with someone on our Programming Services Team; these folks might have the scripting chops to help you to achieve what you are looking for!