Welcome to the LimeSurvey Community Forum

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

Multichoiche array with (other)

  • Matteo_T
  • Matteo_T's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
10 years 4 months ago #101959 by Matteo_T
Multichoiche array with (other) was created by Matteo_T
Hi all i m new here and with LS.
i hope someone can help me, i must use a multichoiche array with last row as an input text
example:

A B C D
E [] [] [] [] <-- all checkbox

F [] [] [] [] <-- all checkbox

G [] [] [] [] <-- all checkbox

H [] [] [] [] <-- In this row i need all input as text [no dependence with previous checkbox]

actualy i have done an Array(number) with layout as checkbox but i miss last row with input [other]

There is a solution for this?

Thanks for help and sorry for my english
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
10 years 4 months ago #101961 by tpartner
Replied by tpartner on topic Multichoiche array with (other)
A solution would be to add an Array(texts) question after the Array(number) question and then use CSS and/or JavaScript to make the questions appear as one. Details of the CSS would depend on the template used.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • Matteo_T
  • Matteo_T's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
10 years 4 months ago - 10 years 4 months ago #101973 by Matteo_T
Replied by Matteo_T on topic Multichoiche array with (other)
Thanks for reply. Where i must set the new css? actualy i use default template
Last edit: 10 years 4 months ago by Matteo_T.
The topic has been locked.
  • Matteo_T
  • Matteo_T's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
10 years 4 months ago #101982 by Matteo_T
Replied by Matteo_T on topic Multichoiche array with (other)
I add a row with js with all input type text at the end of table before </tbody>
i see all the input perfectly but when i save value is always "".
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
10 years 4 months ago #101984 by tpartner
Replied by tpartner on topic Multichoiche array with (other)
That should do it. Can you share your code?

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • Matteo_T
  • Matteo_T's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
10 years 4 months ago #101990 by Matteo_T
Replied by Matteo_T on topic Multichoiche array with (other)
Code:
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
$("#question47").find('tbody:last').append("<tr id='javatbd387651X3X47SQ004' class='array1 subquestion-list questions-list'><th class='answertext'>Altro<input type='hidden' name='java387651X3X47SQ004'id='java387651X3X47SQ004'value=''/></th><td class='answer_cell_00SQ001 answer-item text-item'><label for='answer387651X3X47SQ004_SQ001'><input type='hidden' name='java387651X3X47SQ004_SQ001' id='java387651X3X47SQ004_SQ001'/><input type='text' name='387651X3X47SQ004_SQ001' id='answer387651X3X47SQ004_SQ001' class='empty' title='Università' size='20' value='ciao'/></label></td><td class='answer_cell_00SQ002 answer-item text-item'><label for='answer387651X3X47SQ004_SQ002'><input type='hidden' name='java387651X3X47SQ004_SQ002' id='java387651X3X47SQ004_SQ002'/><input type='text' name='387651X3X47SQ004_SQ002'id='answer387651X3X47SQ004_SQ002'class='empty' title='Centri di ricerca pubblici' size='20' value=''/></label></td><td class='answer_cell_00SQ003 answer-item text-item'><label for='answer387651X3X47SQ004_SQ003'><input type='hidden' name='java387651X3X47SQ004_SQ003' id='java387651X3X47SQ004_SQ003'/><input type='text' name='387651X3X47SQ004_SQ003' id='answer387651X3X47SQ004_SQ003' class='empty' title='Fornitori di servizi innovativi *' size='20' value=''/></label></td><td class='answer_cell_00SQ004 answer-item text-item'><label for='answer387651X3X47SQ004_SQ004'><input type='hidden'name='java387651X3X47SQ004_SQ004' id='java387651X3X47SQ004_SQ004'/><input type='text' name='387651X3X47SQ004_SQ004'id='answer387651X3X47SQ004_SQ004' class='empty' title='Altre imprese manufatturiere' size='20' value=''/></label></td></tr>");
 
});
</script>

i try do add an array(text) and save correctly the input, if i try to save, logout and login survey i find my value.

i noticed that with array(text) on code add a script js as this
Code:
<script type="text/javascript" charset="utf-8">
<!--
$('#question56.question').delegate('input[type=text]:visible:enabled','blurkeyup',function(event){checkconditions($(this).attr('value'),$(this).attr('name'), $(this).attr('type'));
return true;}) 
-->
</script>
so i have try to reply the same script on my js for question47 but has not solved my problem
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
10 years 4 months ago - 10 years 4 months ago #101993 by tpartner
Replied by tpartner on topic Multichoiche array with (other)
The problem is that you are trying to recreate those inputs in Q1 instead of moving the originals there.

Add this to the source of Q1 (the array-numbers). It will hide the array-texts question and move its first answer row to the end of the array-numbers answer table.

Code:
<script type="text/javascript" charset="utf-8">  
 
  $(document).ready(function() { 
 
    // Identify some stuff
    var q1ID = {QID};
    var q1 = $('#question'+q1ID);
    var q2 = $(q1).nextAll('.array-multi-flexi-text:eq(0)');
    var q2ID = $(q2).attr('id').split('question')[1];
 
    // Hide the array-texts
    $(q2).hide();
 
    // Move the row from the array-texts to the array-numbers
    $('table.question tbody', q1).append($('.subquestion-list:eq(0)', q2));
 
    // Fix up the array row background colours
    $('#question'+q1ID+' table.question tbody tr').each(function(i){
      $(this).removeClass('array1 array2').addClass('array'+(2-(i%2)));
    });
  });
</script>


Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 10 years 4 months ago by tpartner.
The following user(s) said Thank You: Matteo_T
The topic has been locked.
  • Matteo_T
  • Matteo_T's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
10 years 4 months ago #101997 by Matteo_T
Replied by Matteo_T on topic Multichoiche array with (other)
thank so much! very nice solution. it's perfect for my problem
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose