Welcome, Guest
Username: Password: Remember me

TOPIC: Create a question with multi array (1-5)

Create a question with multi array (1-5) 1 year 1 month ago #98390

  • gabrielet
  • gabrielet's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 28
  • Thank you received: 1
  • Karma: 0
Hi to all,

is a little bit i didn't write on this forum. How are you?
I'd like to create a particular questionon limesurvey like this:

Question
Bablblblbllblblblblblblblbllb ?

ORGANIZATION |1 - 2| - 3| - 4| - 5
organization bureau | | | |
Visiting and exctiments | | | |
Partecipation | | | |

JOBS DESK
Utility of the course | | | |
Time for project | | | |


This only an example. A question that have multi paragraph and group of response.

I dont want to create for question one for a paragraph...

Suggestions?

Thanks
Gabriele
The administrator has disabled public write access.

Create a question with multi array (1-5) 1 year 1 month ago #98402

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4139
  • Thank you received: 767
  • Karma: 348
There is no built-in provision to add sub-headings to arrays but you can do it with a little JavaScript.

Add the following to the end of template.js:
function insertSubHeading(qID, rowNum, text) {
	var thisQuestion = $('#question'+qID+'');
	var cols = $('table.subquestions-list thead td, table.subquestions-list thead th', thisQuestion).length;
 
	$('#question'+qID+' table.subquestions-list tbody tr:eq('+(rowNum-2)+')').after('<tr class="subHeading"><th class="answertext">'+text+'</th><td colspan="'+(cols-1)+'"></td></tr>');
}


And, then to insert a subheading in row 3 of the array, add something like this to the question source. Replace the row number (3) and the text (SUBHEADING 1) as necessary
<script type="text/javascript" charset="utf-8">	
	$(document).ready(function(){
		insertSubHeading('{QID}', 3, 'SUBHEADING 1');
	});
</script>
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: 1 year 1 month ago by tpartner.
The administrator has disabled public write access.

Create a question with multi array (1-5) 1 year 1 month ago #98410

  • DenisChenu
  • DenisChenu's Avatar
  • OFFLINE
  • Moderator Lime
  • Posts: 6276
  • Thank you received: 801
  • Karma: 241
Hello,

A solution i use sometimes:
If question is not mandatory (but have solution for this too).

Add for subheading in sub question
<strong>My sub heading</strong>

And in js:
$("table.question tbody th > strong").each(function(){
$(this).closest("tr").addClass("sub-heading");
}

In css:
.sub-heading input{display:none}
.sub-heading{background:#ccc}

Denis
Last Edit: 1 year 1 month ago by DenisChenu.
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.123 seconds
Donation Image