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.
This function populates the response value of the given question.
For hidden value, textbox, essay, radio button, drop-down menu, slider and image choice %%value is defined as a "string."
For checkbox and Drag & Drop %%value must be specified as an array.
To set the value of a list of dropdowns, radio button table, and checkbox table %%questionID should be specified as the ID of the table's row.
The following example will set the value of a question to be "yes." The question type could be text, essay, radio button, dropdown menu, or a hidden value action. If it is a radio button or dropdown, you need to make sure that it has the corresponding reporting value.
Next let's set the value of a checkbox question. Let's say our checkbox question has reporting values "a", "b" and "c." Here, we tell our script to check the "a" and "c" options.
%%options = array("a","c"); sgapiSetValue(2,%%options);
For Drag & Drop Ranking questions you'll need to specify an array using the option skus like so:
sgapiSetValue(2,array('10001' => 4, '10002' => 3, '10003' => 2, '10004' => 1));