- Posts: 5
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Matriz de selección y desplegable final
- amoran
- Topic Author
- Offline
- New Member
Less
More
1 year 1 week ago #242551
by amoran
Matriz de selección y desplegable final was created by amoran
Please help us help you and fill where relevant:
Your LimeSurvey version: Versión 5.6.11+230320
Own server or LimeSurvey hosting:
Survey theme/template:
==================
Buenas tardes,
quiero implementar una pregunta de matriz con respuestas cerradas (en columnas o normal) y que la columna final sea desplegable. Es decir, elegir opciones haciendo clic en el botón que consideren de la matriz y que la última columna (X003) sea desplegable.
He visto que hay respuestas para preguntas similares, utilizando una matriz de texto y preguntas desplegables. En este caso sería similar, pero no sé cómo modificar la programación para que, en lugar de campo de texto, aparezca cerrado.
Your LimeSurvey version: Versión 5.6.11+230320
Own server or LimeSurvey hosting:
Survey theme/template:
==================
Buenas tardes,
quiero implementar una pregunta de matriz con respuestas cerradas (en columnas o normal) y que la columna final sea desplegable. Es decir, elegir opciones haciendo clic en el botón que consideren de la matriz y que la última columna (X003) sea desplegable.
He visto que hay respuestas para preguntas similares, utilizando una matriz de texto y preguntas desplegables. En este caso sería similar, pero no sé cómo modificar la programación para que, en lugar de campo de texto, aparezca cerrado.
Please Log in to join the conversation.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12941
- Thank you received: 3979
1 year 1 week ago - 1 year 1 week ago #242563
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Matriz de selección y desplegable final
Asi?
Por este el ejemplo tambien está una matriz(texto).
Los botones 1-5 están exclusivos.
Pero, la columna desplegable. Está una columna exclusiva o no?
Joffm
No, es muy diferente.En este caso sería similar
Por este el ejemplo tambien está una matriz(texto).
Los botones 1-5 están exclusivos.
Pero, la columna desplegable. Está una columna exclusiva o no?
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 1 year 1 week ago by Joffm.
The following user(s) said Thank You: amoran
Please Log in to join the conversation.
- amoran
- Topic Author
- Offline
- New Member
Less
More
- Posts: 5
- Thank you received: 0
1 year 1 week ago #242572
by amoran
Replied by amoran on topic Matriz de selección y desplegable final
Es exactamente eso. ¿Cómo puedo hacerlo? Lo he intentado siguiendo las pautas de este foro:
forums.limesurvey.org/index.php/forum/sp...sta-anterior?start=0
pero no sé cómo modificar la matriz para que aparezca de esa manera.
Gracias!!
forums.limesurvey.org/index.php/forum/sp...sta-anterior?start=0
pero no sé cómo modificar la matriz para que aparezca de esa manera.
Gracias!!
Please Log in to join the conversation.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12941
- Thank you received: 3979
1 year 1 week ago #242573
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Matriz de selección y desplegable final
Hola,
todavía la pregunta:
La columna desplegada es exclusiva o no?
Significa:
Se puede seleccionar un botón y el desplegable (como un comentario)
O
Se puede seleccionar un botón o el desplegable pero no ambos (como una opción 6)
Joffm
todavía la pregunta:
La columna desplegada es exclusiva o no?
Significa:
Se puede seleccionar un botón y el desplegable (como un comentario)
O
Se puede seleccionar un botón o el desplegable pero no ambos (como una opción 6)
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Please Log in to join the conversation.
- amoran
- Topic Author
- Offline
- New Member
Less
More
- Posts: 5
- Thank you received: 0
1 year 1 week ago #242577
by amoran
Replied by amoran on topic Matriz de selección y desplegable final
Se puede seleccionar el botón Y el desplegable (ambos). La idea es seleccionar qué tratamiento farmacológico es adecuado (botón) y, además, indicar si esa decisión corresponde a una de las opciones mostradas en el desplegable.
Please Log in to join the conversation.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12941
- Thank you received: 3979
1 year 1 week ago #242588
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Matriz de selección y desplegable final
Hola,
Bueno, aqui tienes:
script 1: para crear los botónes
script 2: para incluir la columna desplegable
El codigo de esta columna es "X006"
script 3: para ajustar el ancho de las columnas
La exportación lss del ejemplo.
Joffm
Bueno, aqui tienes:
script 1: para crear los botónes
Code:
<script type="text/javascript" charset="utf-8"> // Create the radio buttons $(document).on('ready pjax:scriptcomplete',function(){ // Identify this question var thisQuestion = $('#question{QID}'); // Column-specific classes $('tr.subquestion-list', thisQuestion).each(function(i) { $('th, td', this).each(function(i) { $(this).addClass('column-'+i); }); }); // Insert checkboxes $('.answer-item.column-1, .answer-item.column-2, .answer-item.column-3, .answer-item.column-4, .answer-item.column-5', thisQuestion).addClass('custom-checkbox-item'); $('.custom-checkbox-item', thisQuestion).each(function(i) { var thisID = $('input:text:eq(0)', this).attr('id'); $('label', this).before('<input class="" id="'+thisID+'" value="Y" type="checkbox" name="'+thisID.replace(/answer/, '')+'" />'); if($('input:text:eq(0)', this).val() == 'Y') { $('input:checkbox:eq(0)', this).prop('checked', true); } $(this).removeClass('text-item').addClass('checkbox-item'); $('input:text:eq(0)', this).remove(); }); // Identify exclusive items $('.answer-item.column-1, .answer-item.column-2, .answer-item.column-3, .answer-item.column-4, .answer-item.column-5', thisQuestion).addClass('exclusive-item'); $('.exclusive-item input:checkbox', thisQuestion).on('change', function(e) { if($(this).is(':checked')) { var thisItem = $(this).closest('.answer-item'); $(this).closest('tr.subquestion-list').find('.answer-item').not(thisItem).find('input:checkbox').prop('checked', false); } }); }); </script>
script 2: para incluir la columna desplegable
El codigo de esta columna es "X006"
Code:
<script type="text/javascript" charset="utf-8"> // Insert the drop-down $(document).on('ready pjax:scriptcomplete',function(){ var thisQuestion = $('#question{QID}'); // Insert selects $('.answer-item.answer_cell_X006', thisQuestion).addClass('with-select').append('<select class="inserted-select form-control list-question-select">\ <option value="">...</option>\ <option value="1">Option 1</option>\ <option value="2">Option 2</option>\ <option value="3">Option 3</option>\ <option value="4">Option 4</option>\ <option value="5">Option 5</option>\ <option value="6">Option 6</option>\ </select>'); // Listeners $('.inserted-select', thisQuestion).on('change', function(i) { if($(this).val() != '') { $(this).closest('.answer-item').find('input:text').val($('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()); $('select.inserted-select', thisCell).val(inputText); }); // Clean-up styles $('select.inserted-select', thisQuestion).css({ 'max-width': '100%' }); $('.with-select input:text', thisQuestion).css({ 'position': 'absolute', 'left': '-9999em' }); }); </script>
script 3: para ajustar el ancho de las columnas
Code:
<script type="text/javascript" charset="utf-8"> // Adapt the column widths $(document).on('ready pjax:scriptcomplete',function(){ var thisQuestion = $('#question{QID}'); // Add a question class thisQuestion.addClass('custom-array'); // Column-specific classes $('table.subquestion-list tr', thisQuestion).each(function(i) { $('th, td', this).each(function(i) { $(this).addClass('column-'+i); }); }); }); </script> <style type="text/css">.custom-array table.subquestion-list col { width: auto !important; } .custom-array table.subquestion-list thead .column-0 { width: 25%; } .custom-array table.subquestion-list thead .column-1 { width: 7%; } .custom-array table.subquestion-list thead .column-2 { width: 7%; } .custom-array table.subquestion-list thead .column-3 { width: 7%; } .custom-array table.subquestion-list thead .column-4 { width: 7%; } .custom-array table.subquestion-list thead .column-5 { width: 7%; } .custom-array table.subquestion-list thead .column-6 { width: 40%; } </style>
La exportación lss del ejemplo.
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: amoran
Please Log in to join the conversation.
- amoran
- Topic Author
- Offline
- New Member
Less
More
- Posts: 5
- Thank you received: 0
1 year 1 week ago - 1 year 1 week ago #242589
by amoran
Replied by amoran on topic Matriz de selección y desplegable final
Last edit: 1 year 1 week ago by amoran.
Please Log in to join the conversation.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12941
- Thank you received: 3979
1 year 1 week ago #242592
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Matriz de selección y desplegable final
Preguntaste por una matriz normal.
No tengo más tiempo hoy.
Joffm
En el código para crear los botones encontrarás los lugares que tienes que cambiar.de matriz con respuestas cerradas (en columnas o normal)
No tengo más tiempo hoy.
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: amoran
Please Log in to join the conversation.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12941
- Thank you received: 3979
1 year 6 days ago #242648
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Matriz de selección y desplegable final
Hola,
Quizas ya lo has encontrado.
Solo necesita comentar esa línea con barras diagonales
Quizas ya lo has encontrado.
Solo necesita comentar esa línea con barras diagonales
Code:
// Identify exclusive items // $('.answer-item.column-1, .answer-item.column-2, .answer-item.column-3, .answer-item.column-4, .answer-item.column-5', thisQuestion).addClass('exclusive-item');
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Please Log in to join the conversation.
- amoran
- Topic Author
- Offline
- New Member
Less
More
- Posts: 5
- Thank you received: 0
1 year 6 days ago #242649
by amoran
Replied by amoran on topic Matriz de selección y desplegable final
Sí! Gracias a las diferentes opciones que me has dado he ido combinando y encontrando diferentes alternativas. Muchas gracias.
Please Log in to join the conversation.