SurveyFactory Documentation Documentation Template variables
Template variables
(Redirected from Survey template variables)

Template variables are passed to survey templates each time a page in the response is rendered. These variables allow the template designer to know the current status of the survey and render the response accordingly. This document details all of the variables that are passed into your templates when they are processed.

A variable name ending in a period (.) means that it has more variables in the structure underneath. Some of these will be linked to other pages that describe those variables in more detail. A variable name ending in brackets ([]) means that it is a list of items. Any variables below the list then refer to the contents of each item in the list.

# These variables are always available when the template is being parsed:
survey.
   id
   pid
   title
   timezone
   template.

   config.
   response.
   publication.
   languagefile.

   page.

   questions[]
      # Variables for each question in survey.questions[] depend on question.type
      Choose One Answer
      Choose Multiple Answers
      Single Answer Menu
      Multiple Answer Menu
      Single Text Field
      Text Field List
      One Answer per Row
      Many Answers per Row
      Most Preferred
      Super Matrix
      Ranking List
      Constant Sum
      File Upload
      Dates and Times
      Page
      HTML or Text Content
      Image
      Response Content
      Redirect Respondent

   # The following variables are available under special circumstances:
   previewquestion.
   email.
      type
      subject
      body
   publishmethod.
      type
      template.


survey.pid

This is the plan id of the plan that this survey belongs to in your Account Manager. It is required for the ability of the respondent to download files from the survey that they have uploaded.

survey.previewquestion.

This field is only available if config.display.type is equal to 'preview-question'. If this is the case, this variable holds the template variables for the question being previewed. These variables will depend on the type of the question and can be found in the listing at the top of this page.

survey.email.

This is only available if config.display.type is equal to 'email'. It is currently used to generate HTML formatted email messages for use in the email verification process, save response progress for later process, or for emailed invitations.

survey.publishmethod.

This is only available if config.display.type is equal to 'publish-method'. It is currently used to generate a template specific DHTML Popup code in the link publication. Other methods may be added in the future.