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

The built-in piping feature is not supported for Slider List questions. Fortunately, we can achieve piping in this question type via the custom script as illustrated here.

For this to work the target question must be set up with slider row headers must be identical to the option titles of the source question. Built-in piping should be turned off.

See the script in action in an example survey!

OR

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

Features and functions used in this script:

The Script and Setup

The script below requires for us to plug in the question ID of the source checkbox question, the ID of the target Slider List question and the ID of the next page to jump to if there are no sliders to show as a result of the filtering.

sourceID = 22
targetID = 53
next_pageID = 2

checkbox = getvalue(sourceID)
multi_textbox = getquestionoptions(targetID)

hidden_options = 0
for id,title in pairs (multi_textbox) do
  
   hideoption(targetID,title,false)

   if(not(in_array(title, checkbox))) then

      hideoption(targetID,title,true)
      hidden_options = hidden_options + 1
   end

end

if(count(multi_textbox) == hidden_options) then

   jumptopage(next_pageID)

end

Required Customizations

In the script above you will need to customize variables highlighted in yellow in order to make the script work in your survey.

sourceID - This variable will indicate the question ID of the source Checkbox question.

targetID - This variable will indicate the question ID of the target Multi-sliders question.

next_pageID - The page to jump to if no options are selected in the checkbox question which corresponds to the option titles of each of the multi-slider options.