User Tools

Site Tools


cleavenums

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
cleavenums [2021/11/12 17:01] admincleavenums [2025/05/07 11:17] (current) – [cleaveNums - Format numeric entries on-the-fly] admin
Line 1: Line 1:
 ====== cleaveNums - Format numeric entries on-the-fly ====== ====== cleaveNums - Format numeric entries on-the-fly ======
-The cleaveNums function uses cleave.js to automatically format numeric fields with thousand separators, decimals, currency symbols, etc. in text entry (single or form), matrix, side-by-side or MC questions. It is **NOT** for use with constant sum or matrix constant sum questions (there is a different function for that).+The cleaveNums function uses cleave.js to automatically format numeric fields with thousand separators, decimals, currency symbols, etc. in text entry (single or form), matrix, side-by-side or MC questions. It is **NOT** for use with constant sum or matrix constant sum questions (See [[cleavecsm|cleaveCSM]] for that)
 + 
 +This function is available for a reasonable fee. Contact **[[https://community.qualtrics.com/inbox/conversation?with=373|TomG]]** on the Qualtrics Community to learn more.
  
 ===== Set-up Instructions ===== ===== Set-up Instructions =====
 ==== Survey Header ==== ==== Survey Header ====
 +=== Load cleave.js ===
 +<code>
 +<script src="https://cdn.jsdelivr.net/npm/cleave.js@1/dist/cleave.min.js"></script>
 +</code>
 +=== cleaveNums function ===
 To make the function available to all questions in the survey, copy the function to the Survey Header inside a script tag: To make the function available to all questions in the survey, copy the function to the Survey Header inside a script tag:
 Add the cleaveNums function to the survey header to make it available to any question in the survey.   Go to Look & Feel -> General -> Header edit -> {{::icon_source.jpg?20|}} and paste the provided cleaveNums function JS: Add the cleaveNums function to the survey header to make it available to any question in the survey.   Go to Look & Feel -> General -> Header edit -> {{::icon_source.jpg?20|}} and paste the provided cleaveNums function JS:
Line 11: Line 18:
 Alternatively, paste the cleaveNums function JS into a question's JS outside the existing Qualtrics functions to make it available to questions on the page. Alternatively, paste the cleaveNums function JS into a question's JS outside the existing Qualtrics functions to make it available to questions on the page.
 ==== Question JavaScript ==== ==== Question JavaScript ====
-Add JS to call the mcColumns function to apply it to the Multiple Choice question as follows:+Add JS to call the cleaveNums function to apply it to the the question as follows:
 <code> <code>
 Qualtrics.SurveyEngine.addOnload(function() { Qualtrics.SurveyEngine.addOnload(function() {
Line 26: Line 33:
 ===== Options ===== ===== Options =====
 ==== align ==== ==== align ====
-**align** specifies the alignment of the number within the text entry box. Possible value are "left", "right", and "center".+**align** specifies the alignment of the number within the text entry box. Possible value are %%"left"%%%%"right"%%, and %%"center"%%.
  
-Default: "right"+Default: %%"right"%%
 ==== cleaveparms ==== ==== cleaveparms ====
 **cleaveparms** is an object that specifies the cleave parameters. See [[https://github.com/nosir/cleave.js|cleave.js]] for more details. **cleaveparms** is an object that specifies the cleave parameters. See [[https://github.com/nosir/cleave.js|cleave.js]] for more details.
Line 35: Line 42:
 The thousands separator as a string. The thousands separator as a string.
  
-Default ","+Default %%","%%
 === cleaveparm: prefix === === cleaveparm: prefix ===
 The number prefix as a string, such as a currency symbol. The number prefix as a string, such as a currency symbol.
  
-Default: "" (none)+Default: %%""%% (none)
 === cleavparm: noImmediatePrefix === === cleavparm: noImmediatePrefix ===
 Boolean to not show prefix until a number is entered. Boolean to not show prefix until a number is entered.
Line 55: Line 62:
 The decimal symbol as a string. The decimal symbol as a string.
  
-Default: "."+Default: %%"."%%
 === cleaveparm: numeralPositiveOnly === === cleaveparm: numeralPositiveOnly ===
 Boolean to allow positive numbers only. Boolean to allow positive numbers only.
Line 65: Line 72:
 Default:true Default:true
 ==== fixedDecimal ==== ==== fixedDecimal ====
-Boolean to record number with a fixed number of decimal places. Number of decimal place matches numeralDecimalScale.+Boolean to record number with a fixed number of decimal places. Number of decimal places matches numeralDecimalScale.
  
 Default: false Default: false
Line 75: Line 82:
 The placeholder text for the input boxes. The placeholder text for the input boxes.
  
-Default: ""+Default: %%""%%
 ==== selector ==== ==== selector ====
 CSS style selector for input boxes to format. If empty, all input boxes are formatted. CSS style selector for input boxes to format. If empty, all input boxes are formatted.
  
-Default: "" (empty)+Default: %%""%% (empty)
 ==== width ==== ==== width ====
 The width of the input boxes. If empty, the question's default width is used. The width of the input boxes. If empty, the question's default width is used.
  
-Default: "" (empty) +Default: %%""%% (empty) 
 +====== Qualtrics Wiki ====== 
 +[[start|Qualtrics Wiki]]
  
  
cleavenums.1636754465.txt.gz · Last modified: by admin

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki