f() scripting API, uses native shorthand methods like .inc(), .any(), .all(), and .none() for readability, and supports bidirectional import/export.
Question types
| Questra block | ConfirmIt element | Notes |
|---|---|---|
| Text | <Info> | Static informational content. Markdown is converted to HTML. |
| Text input | <Open> | Numeric inputs use NumericType attribute. |
| Multiple choice (single) | <Single> | Answer elements nested in <Answers>. Supports dropdown layout. |
| Multiple choice (multi) | <Multi> | Answer elements nested in <Answers>. Supports atleast validation. |
| Matrix (single-select) | <Grid> | Statements as <Nodes>, scale points as <Answers>. |
| Matrix (multi-select) | <Grid3D> | Each statement becomes a <Multi> inside <Nodes>, with <Grid3DAnswers>. |
| Rank order | <Multi RankType="true"> | Exported as a multi-select element with ranking enabled. |
| Card sort | <Multi> | ⚠️ Exported as a multi-select question. Cards become answer options. |
| Input list | <Open> | Exported as a single open-ended input. |
| Loop | <Loop> | Full loop support with nested <Nodes>. |
Option groups
Like Decipher, option groups are only wrapped in group elements when a question has multiple groups. Single-group questions place answers directly without additional nesting.Dynamic option groups
Dynamic option groups are materialized usingPrecodeMask scripts. The adapter generates a script that reads the source question’s categories via f().categories() and conditionally shows or hides each materialized answer.
Randomization
When an option group has therandomize flag set, the adapter adds AnswerlistOrder="Randomize" to the question element. Static options within randomized groups receive KeepPosition="true" to anchor them.
Expressions and logic
Questra JavaScript expressions are translated into ConfirmIt’s JScript .NET syntax using thef() API. The adapter emits native shorthand methods where possible, falling back to IIFE (immediately invoked function expression) wrappers only for complex patterns.
Shorthand syntax
For multiple choice questions, the adapter uses ConfirmIt’s native methods instead of verbose IIFE patterns:| Questra JS | ConfirmIt output | Meaning |
|---|---|---|
q1.some(o => o.value == "x") | f('q1').inc('x') | Is option x selected? |
q1.some(o => o.value == "x" || o.value == "y") | f('q1').any('x', 'y') | Is any of x, y selected? |
!q1.some(o => o.value == "x") | f('q1').none('x') | Is option x not selected? |
q1.value == "x" (single-select) | f('q1') == "x" | Direct equality without .get(). |
q1.value (bare access) | f('q1').get() | Retrieve the current value. |
q1.label | f('q1').valueLabel() | Retrieve the selected option’s label. |
o.value == "x" && o.label == "y") fall back to an IIFE that sets up {value, label} item arrays from .categories() and .categoryLabels().
f() API mapping
| JavaScript pattern | ConfirmIt equivalent |
|---|---|
q.value | f('q').get() |
q.label (TextInput) | f('q').text() |
q.label (MC/Matrix) | f('q').valueLabel() |
q.some(o => o.value == "x") | f('q').inc('x') |
q.some(o => ... || ...) | f('q').any('x', 'y') |
q.every(o => ... || ...) | f('q').all('x', 'y') |
!q.some(o => ...) | f('q').none('x') |
q.length | f('q').size() |
!!q (truthy check) | f('q').toBoolean() |
q.statement_1 (Matrix row) | f('q').item('statement_1') |
q[key] (computed access) | f('q').item(key) |
Object.keys(matrix) | f('matrix').domainValues() |
IIFE patterns
For array methods that don’t have a native shorthand (.filter(), .map(), .find(), .reduce()), the adapter wraps the expression in an IIFE:
Variable references
Variables are exported as hidden<Open> elements with VariableType="Hidden". Computed variable expressions are placed in <Script> elements that use f('varName').set(...).
Navigation
| Feature | Support |
|---|---|
| Conditional navigation | ✅ <Condition> with <TrueNodes> containing <CallBlock> or <Stop> |
| Disqualification | ✅ <Stop> with StopType and optional CompleteText |
| Survey completion | ✅ <Stop> element for completion pages |
| Callable blocks | ✅ Pages referenced from multiple paths are extracted into <CallableBlock> |
| Option show/hide | ✅ PrecodeMask scripts that toggle answer visibility |
<Condition> elements with <Script> children that evaluate the expression and set a hidden navigation variable. The <TrueNodes> or <FalseNodes> branches then route to the target page.
Import
The Forsta adapter can import existing surveys by parsing the XML and reconstructing the Questra survey model. During import:- Question elements (
<Single>,<Multi>,<Grid>,<Grid3D>,<Open>,<Info>) are mapped back to Questra block types f()API calls and native shorthands (.inc(),.any(),.all(),.none()) are recognized and converted to JavaScript- IIFE-wrapped expressions are unwrapped back to clean JavaScript
<CallableBlock>pages are reconstructed as additional survey pages<Condition>and<Script>navigation elements are parsed into Questra navigation rules
Warnings
| Condition | Severity | Message |
|---|---|---|
| CardSort block exported | Warning | Exported as a Multi question with limited fidelity |
| Unsupported block type | Error | Block is exported as a placeholder |