SurveyGizmo's CustomScript Action now supports the LUA programming language.
Legacy Custom Scripting Language Deprecation Plans
New accounts (created after October 29, 2018) will only have the option to use Lua in scripts.
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.
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.
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.
As part of our core randomization options, you have the ability to display x number of random questions on the page. Unfortunately, there is not a built-in way to do the same with pages in a survey. Never fear! Fortunately, it's pretty easy to script. We'll cover the steps to use a pretty simple script to accomplish just this. These steps assume a basic familiarity with Alchemer and programming.
Set up your survey pages as you wish. This script supports static pages throughout the pages that are being randomized.
For our example, we're conducting a community services survey. The survey has an initial page where we collect demographic information from the respondent and a thank you page. These pages will always display to each survey respondent.
Following the initial page, there are four pages where we collect information about the following four community services:
waste collection (page ID 3)
the recycling program (page ID 4)
city parks (page ID 5)
dog parks (page ID 6)
In the interest of reducing respondent fatigue and survey abandonment and ultimately getting better data, we only want to burden each respondent with responding to two of the four community services pages.
To set this up we added a custom script action to the initial page (which everyone will see) and pasted the below script.
--Pages to be randomly hidden go here. Make sure they are comma separated, no spaces.
pagesHideRan = {3,7,5,6}
--Amount of pages you want shown from the list above. No quotes or commas are needed.
shown = 2
--Do not change after this line.
shuffled = tableshuffle(pagesHideRan)
for key,page in pairs(shuffled) do
hidepage(page,true)
end
for i=1, shown do
hidepage(shuffled[i],false)
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.
pagesHideRan - PageIDs of the pages you wish to be randomized.