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")]

This function returns a nested array of page IDs with an array of page elements nested within. All survey pages and elements are returned regardless of where in the survey the function is used.

See this function in action in an example survey.
Return TextCorresponding Survey Element Type
AUDIOAudio media element
CASCADING_DROPDOWNCascading Dropdown Menu
CHECKBOXCheckboxes
CONJOINT_NEWChoice-based Conjoint
CONT_SUMContinuous Sum
ESSAYEssay/Long Answer
FILEFile Upload
GROUPContact Form and Custom Group
HEATMAPImage Heatmap
IMAGE_SELECTImage Select (Single and Multi)
INSTRUCTIONSText/Instructions
MATRIXCustom Table
MAXDIFFMax Diff
MEDIAImage Elements
MENUDropdown Menu
MULTI_SLIDERSlider List
MULTI_TEXTBOXTextbox List
NPS®Net Promoter Score®
RADIORadio Buttons and Likert (Rating)
RANKDrag & Drop and Ranking Grid
REACTIONAudio and Video Sentiment
SIGNATURESignature
SLIDERSlider
TABLEGrid question types (Semantic Diff, Star Rating Grid, Radio Button Grid, Dropdown Menu List, Checkbox Grid, All Card Sorts, Dropdown Menu Grid )
TEXTBOXText fields including (textbox number, percent, email, and date)
TEXTHIGHLIGHTERText Highlighter
VIDEOVideo media element

Example

In this example, we return the page map for the entire survey.

pagemap = pagemap()
print(pagemap)

The output would be:

Array ( [12] => Array ( [17] => TEXTBOX [18] => TEXTBOX [19] => TEXTBOX [20] => TEXTBOX [21] => TEXTBOX [23] => MULTI_TEXTBOX [71] => TABLE [22] => ESSAY ) [3] => Array ( [3] => CHECKBOX [42] => TABLE ) [15] => Array ( [79] => RADIO [36] => TABLE [7] => MENU [10] => TABLE [61] => TABLE ) [16] => Array ( [4] => SLIDER [5] => MULTI_SLIDER ) [17] => Array ( [16] => RADIO [32] => TABLE [140] => NPS ) [18] => Array ( [27] => RANK [29] => RANK ) [19] => Array ( [15] => IMAGE_SELECT [9] => IMAGE_SELECT ) [13] => Array ( [80] => FILE ) [20] => Array ( [30] => CONT_SUM [141] => MAXDIFF [93] => GROUP [86] => GROUP [82] => MATRIX [142] => TABLE ) [21] => Array ( [152] => INSTRUCTIONS [153] => MEDIA [154] => MEDIA [155] => MEDIA [156] => AUDIO [159] => VIDEO ) [2] => Array ( [1] => INSTRUCTIONS )

Net Promoter®, NPS®, NPS Prism®, and the NPS-related emoticons are registered trademarks of Bain & Company, Inc., Satmetrix Systems, Inc., and Fred Reichheld. Net Promoter Score℠ and Net Promoter System℠ are service marks of Bain & Company, Inc., Satmetrix Systems, Inc., and Fred Reichheld.