Important Update to Custom Scripting
SurveyGizmo's CustomScript Action now supports the LUA programming language. Visit our NEW Lua Scripting Resources!
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. The exact date on this is to be determined; we will send notifications well ahead of time.
SurveyGizmo supports two kinds of scripting in surveys: Custom Scripting and JavaScript. You can add each to your survey by adding the script to either a Custom Script or JavaScript action respectively.
Custom Scripting is scripting language that we created for SurveyGizmo. The syntax is based on PHP and it includes an API (application program interface) for interacting with the survey. You can implement sophisticated, dynamic survey behavior using Custom Scripting.
JavaScript is a programming language implemented in all browsers. It is used to create websites with sophisticated, interactive behavior. For instance, we use JavaScript for our more fun and interactive question types like the Drag & Drop Ranking question and Sliders.
Server Side vs Client Side
Custom Scripting runs server side and JavaScript runs client side. A good way to think about it is that the Custom Script runs before a respondent sees the page that the script is on and the JavaScript runs after (or while!) they see the page.
SurveyGizmo API
One advantage that Custom Scripting has over JavaScript is the powerful SGAPI functions available to interact with the survey.
For instance, if you want to set the value of a textbox question in SurveyGizmo with Custom Scripting:
sgapiSetValue(%%qid, 'foo');
With JavaScript, you need to set the value through the DOM which makes it more complicated:
document.getElementById(textboxid).value = 'bar';
How can I tell the difference between code written for Custom Scripting and for JavaScript?
If you're not very familiar with Custom Scripting and JavaScript it can be hard to tell the difference between them. The two main things to look for in a custom script are %%, which is put before variable names in custom scripting and sgapi which prefaces custom scripting function names.
Scripting and Other Out-of-the-Box Customizations
We’re always happy to help you debug any documented script. That said, we do not have the resources to write scripts on demand.
If you have customization ideas that you haven't figured out how to tackle, we're happy to be a sounding board for SurveyGizmo features and functionality ideas that might meet your customization. Beyond this, you might want to consult with someone on our Programming Services Team; these folks might have the scripting chops to help you to achieve what you are looking for!