titles between subquestions of the same array

More
6 years 5 months ago #56607 by Mazi
Mazi replied the topic: titles between subquestions of the same array
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)survey-consulting.com'"

Please Log in to join the conversation.

More
5 years 7 months ago #70343 by renu81072
renu81072 replied the topic: titles between subquestions of the same array
Can you please let me know where to add this so that I can use this in my survey URGENTLY. Thanks

Please Log in to join the conversation.

More
5 years 7 months ago #70345 by Mazi
Mazi replied the topic: titles between subquestions of the same array

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)survey-consulting.com'"

Please Log in to join the conversation.

More
5 years 7 months ago #70367 by renu81072
renu81072 replied the topic: titles between subquestions of the same array
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

Please Log in to join the conversation.

More
5 years 7 months ago #70371 by DenisChenu
DenisChenu replied the topic: titles between subquestions of the same array
In the template.css file of the template :)

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in to join the conversation.

More
5 years 7 months ago #70373 by renu81072
renu81072 replied the topic: titles between subquestions of the same array
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

Please Log in to join the conversation.

More
5 years 7 months ago - 5 years 7 months ago #70374 by tpartner
tpartner replied the topic: titles between subquestions of the same array
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;
}


Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Attachments:
Last Edit: 5 years 7 months ago by tpartner.

Please Log in to join the conversation.

More
5 years 7 months ago #70380 by renu81072
renu81072 replied the topic: titles between subquestions of the same array
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:

Please Log in to join the conversation.

More
5 years 7 months ago #70382 by renu81072
renu81072 replied the topic: titles between subquestions of the same array
have replaced QQ with the QuestionID... even then its the same ... :( :(

Please Log in to join the conversation.

More
5 years 7 months ago #70383 by DenisChenu
DenisChenu replied the topic: titles between subquestions of the same array

tpartner wrote: 1) Set up your survey to use JavaScript .

Look at this part:

Go to Global settings --> Security and set "Filter HTML for XSS" to "Off".


:)

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in to join the conversation.

More
5 years 7 months ago #70384 by renu81072
renu81072 replied the topic: titles between subquestions of the same array
Hi.. Now the code does not get displayed.. Thanks.. But still as seen in your image of array1 question, the grouping is not happening.. :(

Have added this code in the template.css
.insertedRow { background-color: #66CCCC; font-weight: bold;} .insertedRow td { text-align: left !important;}

The other code in source... but still the grouping is not happening.. :(

Please Log in to join the conversation.

More
5 years 7 months ago #70385 by tpartner
tpartner replied the topic: titles between subquestions of the same array
Can you activate a sample survey for me to see?

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

Please Log in to join the conversation.

More
5 years 7 months ago #70386 by renu81072
renu81072 replied the topic: titles between subquestions of the same array

Please Log in to join the conversation.

More
5 years 7 months ago #70387 by renu81072
renu81072 replied the topic: titles between subquestions of the same array

Please Log in to join the conversation.

More
5 years 7 months ago #70388 by renu81072
renu81072 replied the topic: titles between subquestions of the same array
Am online as of now.. Can we chat ??

Please Log in to join the conversation.

Did you already participate in our customer survey?

Don't miss your chance for great prices.

Please click here to participate:

Start now

Start now!

Just create your account and start using Limesurvey today.

Register now