niklai niklai - 11 months ago 33
Javascript Question

unsynchronize inputs of textboxs

I tried to move a text box from one question next to another, and to put some text between them. I use the next code for that:

$('QR~QID99').insert({before: 'text before Q99'});
$('QR~QID99').insert({after: $('QR~QID100')});
$('QR~QID100').insert({before: 'text beforeQ100'});
$('QR~QID100').insert({after: 'text after Q100'});

Resulting in this:


The problem is that when previewing the survey the input of one textbox is synchronized with the other textbox. This happens either when filling the first or second textbox, i.e., each textbox is receiving the same input.

I searched and most of the threads are about putting one input in two, or more, textboxes with an ad-hoc function, so that wont work if reversed.


Since nobody else is answering, here are my two cents. Please keep in mind that I'm not a Qualtrics expert, but I've tried the following:

Instead of using two textboxes from two different questions, better use a single question with two textboxes, as you can see in the code below.

$('QR~QID99~1').insert({before: 'text before Q99~1'});
$('QR~QID99~1').insert({after: $('QR~QID99~2')});
$('QR~QID99~2').insert({before: 'text beforeQ99~2'});
$('QR~QID99~2').insert({after: 'text after Q99~2'});

This works, although I'm quite sure that there's a better way to do it.