hello I will appreciate your support
I have a text box where a number is entered, and it should calculate a sample size, which should be saved in an embedded data and displayed at the end of four of the same question.
My problem is that my code is activated only if after adding the number I must click on another question and then the script question.
code:
Qualtrics.SurveyEngine.addOnload(function()
{
var tamuestra;
var inputs = $(this.getQuestionContainer()).select('input[type="text"]');
var input = inputs[0];
$(input).insert({before: ' '});
$(input).insert({after: ' '});
this.questionclick = function(event,element)
{
console.log(event, element);
var choiceNum = this.getChoiceValue(1);
if (choiceNum != '')
{
tamuestra = Math.round((0.9604*choiceNum)/((0.0025*(choiceNum-1))+0.9604));
if (choiceNum < 50)
{
tamuestra = choiceNum;
}
$(input).insert({after: 'Tamaño de muesta: '+tamuestra});
Qualtrics.SurveyEngine.setEmbeddedData("ExternalDataReference", tamuestra);//lo guarda en dato embebido
}
}
});
----------
Tengo un cuadro de texto donde se introduce un número, y debe calcular un tamaño de muestra, que debe guardarse en un dato embebido y mostrarse al final del cuatro de la misma pregunta.
Mi problema es que mi codigo se activa solo si después de agregar el numero debo dar clic en otra pregunta y luego a la pregunta del script.
Best answer by TomG
View original