JavaScript

Why QuestionPro uses JavaScript?

QuestionPro uses JavaScript for custom scripting because JavaScript is,

  • supported on all the browsers.
  • used by the browsers to create dynamic & interactive user experience.
  • syntactically easy and flexible

What are the options to add JavaScript to Questionpro surveys?

QuestionPro provides two options to add JavaScript to your survey:

  1. JavaScript Logic: This option is used to add custom JavaScript on question level to acheive the desired survey flow. The JavaScript logic is further sub-divided into two sub-options:
    • Pre JavaScript logic: This option is used to execute the JavaScript before the question is displayed to the respondents.
    • Post JavaScript logic: This option is used to execute the JavaScript after the next button is clicked.
  2. Custom JS: This option is used to add custom JavaScript on survey level.

FAQs

What do I need to know to start using JavaScript?

HTML forms the basis of any JavaScript and hence good to average knowledge about HTML basics is essential.In addition to that, understanding of basic JavaScript - the syntax, the basic statements, the conditional statements and the data types, is required.


When should I consider using JavaScript validation on the question?

There are multiple scenarios where JavaScript validation could be extremely handy and useful to solve your complex validation problems.
For instance :

  • You want to validate complex questions like flex matrix, conjoint, heatmap etc, where system validations would be limited.
  • Where you would want to validate the question based on response to prior questions in the survey.
  • Do client side validation so the request is not submitted to the server.
  • Very specific/ custom validation on any question type. For instance you want only people who select 1 option from first 5 choices and 1 option from second 5 choices to multiple choice question to proceed.

What are the possible validations I can achieve with this feature

If you are a average to good JavaScript programmer you can solve any validation problem with this feature. A novice to JS could learn the basics and should be able to use the feature to solve straight forward validation problems in the survey.