cleavenums
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| cleavenums [2021/11/12 17:01] – admin | cleavenums [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 | + | 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]] |
| + | |||
| + | This function is available for a reasonable fee. Contact **[[https:// | ||
| ===== Set-up Instructions ===== | ===== Set-up Instructions ===== | ||
| ==== Survey Header ==== | ==== Survey Header ==== | ||
| + | === Load cleave.js === | ||
| + | < | ||
| + | <script src=" | ||
| + | </ | ||
| + | === 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. | Add the cleaveNums function to the survey header to make it available to any question in the survey. | ||
| Line 11: | Line 18: | ||
| Alternatively, | Alternatively, | ||
| ==== Question JavaScript ==== | ==== Question JavaScript ==== | ||
| - | Add JS to call the mcColumns | + | Add JS to call the cleaveNums |
| < | < | ||
| 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 " | + | **align** specifies the alignment of the number within the text entry box. Possible value are %%" |
| - | Default: " | + | Default: |
| ==== cleaveparms ==== | ==== cleaveparms ==== | ||
| **cleaveparms** is an object that specifies the cleave parameters. See [[https:// | **cleaveparms** is an object that specifies the cleave parameters. See [[https:// | ||
| 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: "" | + | Default: |
| === 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: | Default: | ||
| ==== fixedDecimal ==== | ==== fixedDecimal ==== | ||
| - | Boolean to record number with a fixed number of decimal places. Number of decimal | + | Boolean to record number with a fixed number of decimal places. Number of decimal |
| 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: "" | + | Default: |
| ==== width ==== | ==== width ==== | ||
| The width of the input boxes. If empty, the question' | The width of the input boxes. If empty, the question' | ||
| - | Default: "" | + | Default: |
| + | ====== Qualtrics Wiki ====== | ||
| + | [[start|Qualtrics Wiki]] | ||
cleavenums.1636754465.txt.gz · Last modified: by admin
