Welcome, Guest
Username: Password: Remember me

TOPIC: titles between subquestions of the same array

Re:titles between subquestions of the same array 3 years 5 months ago #56607

  • Mazi
  • Mazi's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 5300
  • Thank you received: 291
  • Karma: 247
What's your solution now?

Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)limesurvey.org'"
The administrator has disabled public write access.

Re:titles between subquestions of the same array 2 years 7 months ago #70343

  • renu81072
  • renu81072's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 19
  • Karma: 0
Can you please let me know where to add this so that I can use this in my survey URGENTLY. Thanks
The administrator has disabled public write access.

Re:titles between subquestions of the same array 2 years 7 months ago #70345

  • Mazi
  • Mazi's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 5300
  • Thank you received: 291
  • Karma: 247
adie wrote:
Another trick is may be you can just hide all the radio button for the subtitle in the IMAGE 3 above ;-)
#answer12345X3X12C121-1{
display: none;
}
This is a valid approach, you only need to adjust the IDs and add answers as separators.

Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)limesurvey.org'"
The administrator has disabled public write access.

Re:titles between subquestions of the same array 2 years 7 months ago #70367

  • renu81072
  • renu81072's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 19
  • Karma: 0
I would like to know where this code needs to be inserted.... if i need to add this in the template, then would like to know as exactly in which file? Or should I add this in the Array,using edit in HTML.. Please revert
The administrator has disabled public write access.

Re:titles between subquestions of the same array 2 years 7 months ago #70371

  • DenisChenu
  • DenisChenu's Avatar
  • OFFLINE
  • Moderator Lime
  • Posts: 6205
  • Thank you received: 788
  • Karma: 238
In the template.css file of the template :)
The administrator has disabled public write access.

Re:titles between subquestions of the same array 2 years 7 months ago #70373

  • renu81072
  • renu81072's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 19
  • Karma: 0
Can you let me know what will the whole code be like. Since I would want one line without radio button.. next few lines will should have radio button.. again in between a sub-heading and so on. If you could share with me the full code for this, would appreciate.

Am using the latest limesurvey... Am using Array option
The administrator has disabled public write access.

Re:titles between subquestions of the same array 2 years 7 months ago #70374

  • tpartner
  • tpartner's Avatar
  • NOW ONLINE
  • LimeSurvey Team
  • Posts: 4058
  • Thank you received: 742
  • Karma: 341
Rather than hide radios of sub-questions, I would use JavaScript to insert new rows with the sub-titles.

The following example workaround will insert new rows at positions 1, 3 and 6 as in the image below.

1) Set up your survey to use JavaScript.

2) Add the following script to the source of the array. Replace "QQ" with the array question ID and adjust the row numbers and subtitles as necessary.
<script type="text/javascript" charset="utf-8">
 
	$(document).ready(function() {
 
		// Call the function to insert sub-titles
		// Parameters (Question ID, Row number, Sub-title)
		insertSubTitle(QQ, 1, 'Group 1');
		insertSubTitle(QQ, 3, 'Group 2');
		insertSubTitle(QQ, 6, 'Group 3');
 
		// A function to insert sub-title rows in an array
		function insertSubTitle(qID, row, subtitle) {
 
			// Add some row-specific classes
			$('#question'+qID+' table.question tbody[id^="javatbd"]').each(function(i, el){
				$(el).addClass('ansRow-'+(i+1));
			});
 
			// Find number of columns
			var cols = $('#question'+qID+' table.question tbody[id^="javatbd"]:first tr:first > *').length;
 
			// Define the row to be inserted
			var insertedRow = '<tbody> \
									<tr class="insertedRow"> \
										<td colspan="'+cols+'">'+subtitle+'</td> \
									</tr> \
								</tbody>';
 
			// And insert the row
			$(insertedRow).insertBefore('#question'+qID+' .ansRow-'+row+'');
 
			// Fix up the row background colours
			var rowIndex = 0;
			$('#question'+qID+' table.question tr').each(function(i, el){
				rowIndex ++;
				if($(el).hasClass('insertedRow')) {
					rowIndex = 0;
				}
 
				$(el).removeClass('array1, array2');
 
				if(rowIndex % 2 == 0) {
					$(el).addClass('array1');
				}
				else {
					$(el).addClass('array2');
				}
			});
		}
 
	});
 
</script>

3) Add the following rules to the end of your template.css file:
.insertedRow {
	background-color: #66CCCC;
	font-weight: bold;
}
 
.insertedRow td {
	text-align: left !important;
}

array_subtitles_1.gif
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: 2 years 7 months ago by tpartner.
The administrator has disabled public write access.

Re:titles between subquestions of the same array 2 years 7 months ago #70380

  • renu81072
  • renu81072's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 19
  • Karma: 0
Hi: Have included the javascript while creating the array question. i.e., have inserted after the text what needs to get displayed in the source... Also the other code in the template.css file... but am attaching as to how it looks after have done all these changes...

Am using 1.91+ version

Regards
Renu
Attachments:
The administrator has disabled public write access.

Re:titles between subquestions of the same array 2 years 7 months ago #70382

  • renu81072
  • renu81072's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 19
  • Karma: 0
have replaced QQ with the QuestionID... even then its the same ... :( :(
The administrator has disabled public write access.

Re:titles between subquestions of the same array 2 years 7 months ago #70383

  • DenisChenu
  • DenisChenu's Avatar
  • OFFLINE
  • Moderator Lime
  • Posts: 6205
  • Thank you received: 788
  • Karma: 238
tpartner wrote: Look at this part:
Go to Global settings --> Security and set "Filter HTML for XSS" to "Off".

:)
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.146 seconds
Donation Image