Welcome, Guest
Username: Password: Remember me

TOPIC: Multichoiche array with (other)

Multichoiche array with (other) 9 months 4 weeks ago #101959

  • Matteo_T
  • Matteo_T's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 5
  • Karma: 0
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 administrator has disabled public write access.

Multichoiche array with (other) 9 months 4 weeks ago #101961

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4195
  • Thank you received: 789
  • Karma: 359
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.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.

Multichoiche array with (other) 9 months 4 weeks ago #101973

  • Matteo_T
  • Matteo_T's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 5
  • Karma: 0
Thanks for reply. Where i must set the new css? actualy i use default template
Last Edit: 9 months 4 weeks ago by Matteo_T.
The administrator has disabled public write access.

Multichoiche array with (other) 9 months 4 weeks ago #101982

  • Matteo_T
  • Matteo_T's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 5
  • Karma: 0
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 administrator has disabled public write access.

Multichoiche array with (other) 9 months 4 weeks ago #101984

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4195
  • Thank you received: 789
  • Karma: 359
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.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.

Multichoiche array with (other) 9 months 4 weeks ago #101990

  • Matteo_T
  • Matteo_T's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 5
  • Karma: 0
<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
<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 administrator has disabled public write access.

Multichoiche array with (other) 9 months 4 weeks ago #101993

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4195
  • Thank you received: 789
  • Karma: 359
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.

<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>

Capture2_2013-11-26.PNG
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
Last Edit: 9 months 4 weeks ago by tpartner.
The administrator has disabled public write access.
The following user(s) said Thank You: Matteo_T

Multichoiche array with (other) 9 months 4 weeks ago #101997

  • Matteo_T
  • Matteo_T's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 5
  • Karma: 0
thank so much! very nice solution. it's perfect for my problem
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.200 seconds
Donation Image