Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

matriz de triple eje

  • gjarillo
  • gjarillo's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
3 years 10 months ago #200721 by gjarillo
matriz de triple eje was created by gjarillo
Hola
Tengo instalada la versión 3.17 de limesurvey. Necesito hacer una matriz con mas de 2 escalas con lista desplegable
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 10 months ago #200722 by Joffm
Replied by Joffm on topic matriz de triple eje
¿Quieres hacerlo así?




Pegue esto en el texto de la pregunta (código fuente).
Por supuesto que tienes que ajustarlo.
Code:
<script type="text/javascript" charset="utf-8">
  $(document).on('ready pjax:scriptcomplete',function(){
    var thisQuestion = $('#question{QID}');
 
    // Insert selects
    $('.answer-item.answer_cell_X001', thisQuestion).addClass('with-select').append('<select class="inserted-select form-control list-question-select">\
                          <option value="">Por favor...</option>\
                          <option value="1">rojo</option>\
                          <option value="2">azul</option>\
                          <option value="3">amarillo</option>\
                          <option value="4">verde</option>\
                        </select>'); 
    $('.answer-item.answer_cell_X002', thisQuestion).addClass('with-select').append('<select class="inserted-select form-control list-question-select">\
                          <option value="">Por favor...</option>\
                          <option value="1">opcion 1</option>\
                          <option value="2">opcion 2</option>\
                          <option value="3">opcion 3</option>\
                          <option value="4">opcion 4</option>\
                        </select>'); 
    $('.answer-item.answer_cell_X003', thisQuestion).addClass('with-select').append('<select class="inserted-select form-control list-question-select">\
                          <option value="">Por favor...</option>\
                          <option value="1">Una ora</option>\
                          <option value="2">Dos oras</option>\
                          <option value="3">Tres oras o mas</option>\
                        </select>'); 
    $('.answer-item.answer_cell_X004', thisQuestion).addClass('with-select').append('<select class="inserted-select form-control list-question-select">\
                          <option value="">Por favor...</option>\
                          <option value="1">Pato</option>\
                          <option value="2">Ganso</option>\
                          <option value="3">Pavo</option>\
                        </select>'); 
    $('.answer-item.answer_cell_X005', thisQuestion).addClass('with-select').append('<select class="inserted-select form-control list-question-select">\
                          <option value="">Por favor...</option>\
                          <option value="1">HONDA</option>\
                          <option value="2">TOYOTA</option>\
                          <option value="3">NISSAN</option>\
                          <option value="3">MITSUBISHI</option>\
                        </select>'); 
 
    // Listeners
    $('.inserted-select', thisQuestion).on('change', function(i) {
      if($(this).val() != '') {
        $(this).closest('.answer-item').find('input:text').val($.trim($('option:selected', this).text())).trigger('change');
      }
      else {
        $(this).closest('.answer-item').find('input:text').val('').trigger('change');
      }
    });
 
    // Returning to page
    $('.with-select input:text', thisQuestion).each(function(i) {
      var thisCell = $(this).closest('.answer-item');
      var inputText = $.trim($(this).val());
      var selectval = $('select.inserted-select option', thisCell).filter(function () { return $(this).html() == inputText; }).val();
      $('select.inserted-select', thisCell).val(selectval);
    });
 
    // Clean-up styles
    $('select.inserted-select', thisQuestion).css({
      'max-width': '100%'
    });
    $('.with-select input:text', thisQuestion).css({
      'position': 'absolute',
      'left': '-9999em'
    });
  });
</script>

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: gjarillo
The topic has been locked.
  • gjarillo
  • gjarillo's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
3 years 10 months ago #200724 by gjarillo
Replied by gjarillo on topic matriz de triple eje
¡¡Muchas gracias!!
The topic has been locked.
  • gjarillo
  • gjarillo's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
3 years 10 months ago #200725 by gjarillo
Replied by gjarillo on topic matriz de triple eje
Perdona que vuelva a preguntar: ¿el tipo de pregunta que tengo que elegir es matriz o matriz doble eje?
Gracias de nuevo
Me parece increíble que me puedas contestar un sábado!
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 10 months ago #200734 by Joffm
Replied by Joffm on topic matriz de triple eje
Matriz(textos)

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: gjarillo
The topic has been locked.
  • gjarillo
  • gjarillo's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
3 years 10 months ago #200735 by gjarillo
Replied by gjarillo on topic matriz de triple eje
Muchas gracias!!!
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 10 months ago #200779 by holch
Replied by holch on topic matriz de triple eje

Tengo instalada la versión 3.17 de limesurvey. Necesito hacer una matriz con mas de 2 escalas con lista desplegable


Como la versión 3.17.x tenia una vulnerabilidad de XSS, deberias hacer un update hasta la version 3.22.19 LTS, que es la última versión de esta versión de LS (no recomendo el uso productivo de la versión 4.x todavia).

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The following user(s) said Thank You: gjarillo
The topic has been locked.
  • gjarillo
  • gjarillo's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
3 years 10 months ago - 3 years 10 months ago #200783 by gjarillo
Replied by gjarillo on topic matriz de triple eje
Este es el script modificado para poder hacer 5 columnas en la matriz, 3 desplegables y 2 de texto



<script>
$(document).on('ready pjax:scriptcomplete',function(){
var thisQuestion = $('#question16941');

// Insert selects


$('.answer-item.answer_cell_tipoEmpleo', thisQuestion).addClass('with-select').append('<select class="inserted-select form-control list-question-select">
<option value="">Seleccione una opción</option>
<option value="C">Plantilla</option>
<option value="P">Prestaciones</option>
</select>');
$('.answer-item.answer_cell_puestoTrab', thisQuestion).addClass('with-select').append('<select class="inserted-select form-control list-question-select">
<option value="">Seleccione una opción</option>
<option value="D">Director de centro</option>
<option value="C">Coordinador de Programas</option>
<option value="A">Asesor Técnico</option>
<option value="T">Trabajador social</option>
<option value="E">Educador</option>
<option value="M">Animador/Monitor</option>
<option value="V">Administrativo/Auxiliar Administrativo</option>
<option value="X">Auxiliar de hogar/Trabajador familiar</option>
<option value="S">Servicios auxiliares y oficios</option>
<option value="O">Otros</option>
</select>');
$('.answer-item.answer_cell_equipamiento', thisQuestion).addClass('with-select').append('<select class="inserted-select form-control list-question-select">
<option value="">Seleccione una opción</option>
<option value="CSS">Centro de Servicios Sociales</option>
<option value="AAT">Alojamiento Temporal</option>
<option value="CA">Centro de acogida</option>
<option value="CS">Comedor social</option>
<option value="OI">Oficina de información</option>
<option value="CD">Centro de día</option><option value="MR">Miniresidencia</option>
<option value="PT">Piso Tutelado</option>
<option value="R">Residencia</option>
<option value="OI">Otros</option>
</select>');


// Listeners
$('.inserted-select', thisQuestion).on('change', function(i) {
if($(this).val() != '') {
$(this).closest('.answer-item').find('input:text').val($.trim($('option:selected', this).val())).trigger('change');
}
else {
$(this).closest('.answer-item').find('input:text').val('').trigger('change');
}
});

// Returning to page
$('.with-select input:text', thisQuestion).each(function(i) {
var thisCell = $(this).closest('.answer-item');
var inputText = $.trim($(this).val());
var selectval = $('select.inserted-select option', thisCell).filter(function () { return $(this).html() == inputText; }).val();
$('select.inserted-select', thisCell).val(selectval);
});

// Clean-up styles
$('select.inserted-select', thisQuestion).css({
'max-width': '100%'
});
$('.with-select input:text', thisQuestion).css({
'position': 'absolute',
'left': '-9999em'
});
});

</script>
Last edit: 3 years 10 months ago by gjarillo.
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 10 months ago #200786 by Joffm
Replied by Joffm on topic matriz de triple eje
Solo para decir:

$('#question{QID}');

{QID} es una variable de LimeSurvey. Se reemplaza automáticamente por el número de la pregunta.
Por eso no deberías cambiar esto por $('#question16941')

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: holch
The topic has been locked.
  • gjarillo
  • gjarillo's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
3 years 10 months ago #200792 by gjarillo
Replied by gjarillo on topic matriz de triple eje
De acuerdo! Muchas gracias
Hace bastante tiempo que utilizo limesurvey pero tengo muchas "lagunas".
The topic has been locked.
More
3 years 5 months ago #207644 by elenamiranda
Replied by elenamiranda on topic matriz de triple eje
¿Dónde pones el script para poner las columnas desplegables y la que no son?
The topic has been locked.
  • gjarillo
  • gjarillo's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
3 years 5 months ago #207702 by gjarillo
Replied by gjarillo on topic matriz de triple eje
El scrip lo pones en la pregunta, en la pantalla del código HTML
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose