Skip to content

Instantly share code, notes, and snippets.

@iberck
Last active October 25, 2017 23:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iberck/73fab54705b702ba84f204cf58a770b1 to your computer and use it in GitHub Desktop.
Save iberck/73fab54705b702ba84f204cf58a770b1 to your computer and use it in GitHub Desktop.

Mostrar una respuesta por defecto al mostrar la pregunta (opc múltiple con otra)

P7 muestra por defecto elegida la opción P7_1 (televisa), P7_2 (tv azteca)

importPackage(com.liquidsoft.msurvey.api);

function onNavigate(params) {
    var node = ApiClient.findQuestionOptions($node);
    // TODO: cambiar el tipo de respuesta si fuera necesario
    var answer1 = new MAOptions(C.A_TYPE_OPT_MULTIPLE_OTHER, node);
    var selectedOpts = new JSONArray();
    selectedOpts.put("P7_1");
    selectedOpts.put("P7_2");
    answer1.setOptions(selectedOpts);
    answer1.setOptionsShowOrder(node.getVisibleOptionsJSONArray());
    // TODO: establecer el texto de la opción otra
    // answer1.setOtherText(answer1.getEnterOtherText());
    ApiClient.addTemporalAnswer($node, answer1);
    
    var answer = ApiClient.showAndWait($node);
    var next = ApiClient.findNext($node);
    return next;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment