Thomas Gibbons Consulting Qualtrics Wiki

Contact TomG on Qualtrics Community

User Tools

Site Tools


orderformmatrix

orderFormMatrix - Text entry matrix with quantities, prices, and totals

The orderFormMatrix function enables the creation of an order form with quantities, prices, and totals using a text entry matrix question.

Functionality and features include:

  • Calculates item subtotals, total quantity, and total price as quantities are entered
  • Price, subtotal, and total fields are read-only
  • Tab to quantity inputs
  • Allows only valid numeric input
  • Saves all data, including prices, subtotals, and totals, in response data
  • Supports specification of subtotal and total decimal places
  • Supports whole number or decimal quantities
  • Supports custom CSS styling (examples provided)
  • Compatible with back button

Here is an example:

This function is available for a reasonable fee. Contact TomG on the Qualtrics Community to learn more.

Set-up Instructions

Add Function To Survey

Add the orderFormMatrix function to the survey header to make it available to any question in the survey. Go to Look & Feel → General → Header edit → and paste the provided orderFormMatrix function JS:

<script>/*Paste orderFormMatrix function JS here*/</script>

Alternatively, paste the orderFormMatrix function JS into a question's JS outside the existing Qualtrics functions to make it available to questions on the page.

JavaScript Function Call

Add JS to call the orderFormMatrix function to apply it to the text entry matrix question as follows:

Qualtrics.SurveyEngine.addOnload(function() {
	orderFormMatrix(this);
});

To override the default options, specify the desired options in the second function argument as an object. For example:

Qualtrics.SurveyEngine.addOnload(function() {
	orderFormMatrix(this,{qtyDecimals:1});
});

Question Settings

  • Matrix
  • Matrix Type: Text entry
  • Scale points: 3 (In order: Quantity, Price, Total)
  • Statements: Items + Total as last row
  • Default choices: Prices for all Items

Custom CSS

The orderFormMatrix function adds the class “ofm” to the question to enable custom CSS formatting of orderFormMatrix questions. This can be used to make totals bold, add currency symbols before or after prices, set the width of inputs, hide the price column (if prices are included in the item labels), etc.. Example CSS rules are provided with the orderFormMatrix function.

Options

qtyDecimals

qtyDecimals specifies the number of decimals allowed in quantity fields.

Default: 0

totalDecimals

totalDecimals the number of decimal places that should be displayed in the price subtotals and total. Amounts are rounded if necessary.

Default: 2

Qualtrics Wiki

orderformmatrix.txt · Last modified: 2023/10/20 11:20 by admin

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki