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.
This function allows you to set the value for an individual cell in a custom table question.
Parameters*
Description
Type
Required
columnID
the question ID of the Custom Table
integer
true
rowname
the row header text
integer
true
value
The value you wish to set
string
false
*Provide parameters in the above order.
Example
The custom table has two rows and two column questions (one radio button and one textbox). In this example, we will pre-populate the radio button question with the answer "No" using setcustomtablevalue.
The custom table questionID is 2, however, each column has its own ID as well. We'll need to pull these IDs in order to set specific rows. To do so, we'll add a custom script action before the custom table question on the page and paste the below code. This will pull the IDs for the columns of our custom table.
sub_IDs = gettablequestionskus(2)
print(sub_IDs)
Next, we'll preview the page with the script and the custom question. The below array will be output.
As such, the return indicates that our first column [0] Radio has an ID of 3 and the second column [1] Textbox has an ID of 4.
Array([0] => 3 [1] => 4 )
Now that we have our column IDs, we're going to go back to our custom script action and delete the code to obtain our custom table question SKUs and replace with the below.
value = 'No' --The reporting value of the option we're prepopulating
setcustomtablevalue(3,'Row 1',value)
3 is the Radio column ID.
Row 1 is the row of the column we're prepopulating.
value is the reporting value for the option we'd like to preselect.