Version: 3.17.3 How to Bold current question or add a check mark when answered

More
1 year 2 months ago #184228 by EPSRCAC1
I have researched this and found options for the older versions, but can't seem to find one that addresses this same need in version 3.17.3.

Any idea, code, what have you on creating a way to show what is responded to or not - it can be colors or checkmarks. Just need help with the actual code and where to place it in V 3.17.3.

Thanks,

E
The topic has been locked.
LimeSurvey Partners
More
1 year 2 months ago #184230 by holch
But if it is answered it is answered. Isn't that already an indicator?

Could you give some more information? Maybe how you would like it to look like?

What question type do you want this for?

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
The topic has been locked.
More
1 year 2 months ago #184231 by EPSRCAC1
This is what I am looking for, but for version 3. The instructions for this post are pre-version 3: www.limesurvey.org/forum/design-issues/9...k-mark-when-answered
The topic has been locked.
More
1 year 2 months ago #184232 by holch
I guess you will have to wait until Tpartner shows up and adapts his script for 3.0

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
The topic has been locked.
More
1 year 2 months ago #184233 by EPSRCAC1
So no one has a solution for this?
The topic has been locked.
More
1 year 2 months ago #184235 by holch

So no one has a solution for this?

How should I know that???
You've posted your question 3,5h ago on a Friday afternoon. I guess you will have to wait a little longer to draw such a conclusion.

But your best chance is that Tpartner adapts his original script to 3.x, if not already done. So you just need to wait. Tpartner will quite probably show up at one point.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
The topic has been locked.
More
1 year 2 months ago #184242 by tpartner
Can you attach a sample survey containing all of those question types?

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Official LimeSurvey Partner - partnersurveys.com
The topic has been locked.
More
1 year 2 months ago #184253 by EPSRCAC1
As requested.

File Attachment:

File Name: surveys_archive1.zip
File Size:9 KB
Attachments:
The topic has been locked.
More
1 year 2 months ago #184272 by tpartner
Sorry, I don't have time to go through your working survey.

What I meant was to attach a sample survey containing only the question types listed in the post that you linked to.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Official LimeSurvey Partner - partnersurveys.com
The topic has been locked.
More
1 year 2 months ago - 1 year 2 months ago #184275 by EPSRCAC1
Sorry for the misunderstanding. The link is as follows:




This survey only uses:
  • Short free text
  • Yes/No
  • List (radio)
Last edit: 1 year 2 months ago by EPSRCAC1. Reason: update
The topic has been locked.
More
1 year 2 months ago #184276 by holch
He does not want a link but a LSS file, with only the question types that are important.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
The following user(s) said Thank You: EPSRCAC1
The topic has been locked.
More
1 year 2 months ago - 1 year 2 months ago #184277 by EPSRCAC1
As requested

File Attachment:

File Name: surveys_archive2.zip
File Size:5 KB
Attachments:
Last edit: 1 year 2 months ago by EPSRCAC1.
The topic has been locked.
More
1 year 2 months ago #184434 by epauldc29
Attached is the LSS file

File Attachment:

File Name: limesurvey...6835.lss
File Size:26 KB
Attachments:
The topic has been locked.
More
1 year 2 months ago - 1 year 2 months ago #184458 by tpartner
Place this in your custom.js file to assign a class "answered" to those types of questions when answered:

$(document).on('ready pjax:scriptcomplete',function(){
 
	// Initial "answered" states
	$('div[id^="question"]').addClass('unanswered');
	$('div[id^="question"] tr[id^="javatbd"]').addClass('unanswered');
	$('input:radio:checked, input:checkbox:checked, select[id^="answer"][value!=""], input:text[value!=""], textarea[value!=""]').each(function(i) {
		handleAnswers(this);
	});		
 
	// Listeners on the answers
	$('input:radio, input:checkbox, select[id^="answer"]').on('change', function(){
		 handleAnswers(this);
	});
	$('input:radio').on('click', function(){
		 handleAnswers(this);
	});
	$('input:text, textarea').on('keyup change', function(){
		 handleAnswers(this);
	});	
	$('.array-flexible-row tr[id^="javatbd"] td').click(function(){
		 handleAnswers($('input:radio', this));
	});
});
 
// A function to test for answered questions
function handleAnswers(input) {
	var parentQuestion = $(input).closest('div[id^="question"]');
	var parentRow = $(input).closest('tr[id^="javatbd"]');
 
	// Radio lists (anything checked)
	if($(parentQuestion).hasClass('list-radio') || $(parentQuestion).hasClass('yes-no') || $(parentQuestion).hasClass('gender') || $(parentQuestion).hasClass('choice-5-pt-radio') || $(parentQuestion).hasClass('list-with-comment')) {
		markAnswered(parentQuestion);
	}
	// Dropdown lists (anything selected)
	else if($(parentQuestion).hasClass('list-dropdown')) {
		if($(input).val() != '') {
			markAnswered(parentQuestion);
		}
		else {
			markUnanswered(parentQuestion);
		}
	}
	// Short-text, long-text, huge-text and numeric (any value in the input)
	else if($(parentQuestion).hasClass('text-short') || $(parentQuestion).hasClass('text-long') || $(parentQuestion).hasClass('text-huge') || $(parentQuestion).hasClass('numeric')) {
		if($(input).val() != '') {
			markAnswered(parentQuestion);
		}
		else {
			markUnanswered(parentQuestion);
		}
	}
	// Multi-short-text (all inputs must have a value)
	else if($(parentQuestion).hasClass('multiple-short-txt')) {
		if($('input:text[value!=""]', parentQuestion).length == $('input:text', parentQuestion).length) {
			markAnswered(parentQuestion);
		}
		else {
			markUnanswered(parentQuestion);
		}
	}
	// Array (all rows must have a checked radio)
	else if($(parentQuestion).hasClass('array-flexible-row')) {
		if($('input:radio:checked', parentQuestion).length == $('tr[id^="javatbd"]', parentQuestion).length) {
			markAnswered(parentQuestion);
		}
		else {
			markUnanswered(parentQuestion);
		}
		markAnswered(parentRow);
	}
	// Array-numbers (all dropdowns must have a value)
	else if($('.multiflexiselect', parentQuestion).length != 0) {
		if($('.multiflexiselect[value!=""]', parentQuestion).length == $('.multiflexiselect', parentQuestion).length) {
			markAnswered(parentQuestion);
		}
		else {
			markUnanswered(parentQuestion);
		}
		if($('.multiflexiselect[value!=""]', parentRow).length == $('.multiflexiselect', parentRow).length) {
			markAnswered(parentRow);
		}
		else {
			markUnanswered(parentRow);
		}
	}
	// Multiple options (at least one option checked)
	else if($(parentQuestion).hasClass('multiple-opt')) {
		if($('input:checkbox:checked', parentQuestion).length != 0) {
			markAnswered(parentQuestion);
		}
		else {
			markUnanswered(parentQuestion);
		}
	}
}
 
// Assign classes to "answered" questions
function markAnswered(el) {
	$(el).removeClass('unanswered').addClass('answered');
}
function markUnanswered(el) {
	$(el).removeClass('answered').addClass('unanswered');
}

Then, you can use a rule something like this in custom.css:

.question-container.answered {
	background: green;
}

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Official LimeSurvey Partner - partnersurveys.com
Last edit: 1 year 2 months ago by tpartner.
The topic has been locked.

Start now!

Just create your account and start using Limesurvey today.

Register now