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.


Updated Articles

  1. gettablequestiontitles

    This function accepts the Question ID of a table and returns an array in the following format: [questionID] => "title"  See this function in action in an example survey . Parameters Description Required questionID the ID of the questio...
  2. getsurveyprogress

    This function returns the percentage progress based on survey pages. See this function in action in an example survey . Example If the below script is placed at the top of each survey page of a six-page survey (including the Thank You page) the ...
  3. getquestionruntimeproperty

    This question returns the specified runtime property for the given question ID. See this function in action in an example survey . Parameters* Description Required questionID the ID of the question true property the property...
  4. getquestionoptionselected

    This function returns the option ID for the selected answer. For multi-select questions, an array will be returned. See this function in action in an example survey . Parameters Description Required questionID the ID of the questio...
  5. currentpagetitle

    This function will return the title of the current page. See this function in action in an example survey . The below example outputs the current page title to the page. print(currentpagetitle()) The output would be: Demographics See also the...
  6. addcontacttoinvite

    This function adds a contact with the specified fields to the given invite. This function allows you to collect contact information in one survey and then add those contacts to an email campaign in another survey.  Parameters Description Req...
  7. How to Find IDs for Custom Scripts

    Answer options, questions, pages, and surveys have unique identifiers that can be referenced in your scripts.  Survey ID To get the Survey ID, look at the URL bar while you're in the survey Build tab. The number that follows /id/ is your survey ...
  8. How to Find JavaScript Element IDs

    If you're using JavaScript you'll eventually need to find out your element ID. You'll need to take advantage of your browser's developer tools. Developer tools for each browser vary. Learn how to access developer tools on your preferred browser. ...
  9. Using SurveyGizmo Merge Codes in JavaScript

    You can use SurveyGizmo merge codes in JavaScript actions in your survey. Our servers will replace the merge code with the corresponding value when the page is rendered. When the JavaScript code executes on the client side, the merge code will have ...
  10. setcustomtablevalue

    This function allows you to set the value for an individual cell in a custom table question. Parameters* Description Type Required columnID the question ID of the Custom Table integer true rowname the row header text intege...