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. Verify and disqualify based on birthdate

    This script will perform age verification based on the date of birth entered in a Date question. The qualifying age can be set in the script (18 years old, 21 years old, etc.) and if the user is not old enough, they will be disqualified. If they are...
  2. Show/Hide Logic based on MaxDiff

    In this example, we cover a script to conditionally show text elements based on the attributes that are rated highest in a MaxDiff question. See this script in action in an example survey . OR Add a survey with this script and setup to your ac...
  3. Dynamically set Continuous Sum Max Total

    The Continuous Sum question is a very popular question, particularly with our market researchers. Often survey designers are looking to make sure that the continuous sum total matches another value that the respondent entered. In this tutorial, we'l...
  4. lprint

    This function was primarily created for outputting the list function to the page as the Lua print function results in merge code errors within the survey.  Parameters Description Required contents the contents you wish to print true ...
  5. luadecrypt

    Decrypts the given encrypted string. Parameters Description Required string the string you wish to decrypt true key the string key/password used for encryption/decryption true ciphertype a string calling the cipher algorithm ...
  6. luaencrypt

    Encrypts the given string. Parameters Description Required string the string you wish to encrypt true key the string key/password used for encryption/decryption true ciphertype a string calling the cipher algorithm used by en...
  7. tableshuffle

    This function shuffles the elements of a Lua table. Parameters Description Required array the array you wish to shuffle true Example The below example creates a new array and sets it equal to the original array that has been sh...
  8. setothervalue

    This function populates the response for other textboxes . If you wish to set the value of a question use the setvalue function. Parameters* Description Required questionID the ID of the question true reporting_value the reportin...
  9. list

    This function returns the list of responses for the given survey. This is equivalent to a get list on the SurveyResponse object via the RestAPI. To learn more visit the SurveyResponse API Object documentation. Parameters* Description Require...
  10. csvsplit

    Splits the given comma-separated string into an array. Parameters Description Required string the comma-separated string you wish to split into an array true Example In the below example we create an array from a comma-separated li...