Lua Scripting Resources

Important Update to Custom Scripting

SurveyGizmo's CustomScript Action now supports the LUA programming language.


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. Read-only scripts will continue to function; you will just be prevented from editing. The exact date on this is to be determined; we will send notifications well ahead of time.


 Go to our Legacy Scripting Documentation.

While SurveyGizmo is one of the most flexible survey tools around, we get requests for customizations that are not available out of the box. This is where JavaScript and Custom Scripting can save the day. If you have scripting chops you can use the JavaScript action or the Custom Scripting action to achieve the survey of your dreams.


[article("bodfy")]

Customers frequently request the ability to 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. 

See the script in action in an example survey.

OR

Add a survey with this script and setup to your account.

The Script

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.