Bold current question or add a check mark when answered

More
3 years 11 months ago #94621 by kateibe
Hi,

For the "Array" type questions the color doesn't seem to change when a question is answered (any radio button is selected for a row). Please see the picture below. Ideally the question will change color once any row of the array question has an answer, but right now even if all rows have an answer the color doesn't change. Thank you so much for your help!

Kat :)
Attachments:

Please Log in to join the conversation.

More
3 years 11 months ago - 3 years 11 months ago #94652 by tpartner

For the "Array" type questions the color doesn't seem to change when a question is answered (any radio button is selected for a row).

No, as the comments in the code indicate, the array will be considered "answered" if all rows have a checked radio.

If you want the array to be considered "answered" if any radio is checked, replace this code block:
		// 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);
		}

With this:
		// Array (one radio must be checked)
		else if($(parentQuestion).hasClass('array-flexible-row')) {
			markAnswered(parentQuestion);
			markAnswered('tr[id^="javatbd"]', parentRow);
		}

...but right now even if all rows have an answer the color doesn't change.

I can't reproduce that problem. Can you activate a demo survey?

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last Edit: 3 years 11 months ago by tpartner.
The following user(s) said Thank You: kateibe

Please Log in to join the conversation.

More
3 years 11 months ago #94936 by kateibe
Hi Tony,

Thank you so much for your prompt response. Please see the link below for a test survey. It still doesn't seem to be working. Thank you so much for all your help!

Kat
limesurvey.Partners.org/limesurvey/index.php?sid=12271&lang=en

Please Log in to join the conversation.

More
3 years 11 months ago #94939 by tpartner
Ah, this workaround was developed for LS 2.0 but it looks like you're using LS 1.92.

Replace this block:
		$('.array-flexible-row tr[id^="javatbd"] td').click(function(){
			 handleAnswers($('input.radio', this));
		});

With this block:
		$('.array-flexible-row tbody[id^="javatbd"] td').click(function(){
			 handleAnswers($('input.radio', this));
		});

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: kateibe

Please Log in to join the conversation.

More
3 years 11 months ago #95062 by kateibe
Hi Tony,

Thank you again for your prompt response! After some more testing it worked like a charm! Thank you for all your help!! I'm so happy and excited with the finished product! :laugh:

with gratitude,

Kat

Please Log in to join the conversation.

More
3 years 10 months ago #95794 by kateibe
Hello,

My organization recently upgraded to Limesurvey 2.0 and now the color coding does not work...Could you please provide code that would work for LS 2.0. Thank you so much for your help! I had it all working and then we upgraded!! :(

Kat

Please Log in to join the conversation.

More
3 years 10 months ago #95795 by tpartner
All of the code prior to 3 posts ago was developed for LimeSurvey 2. Go back to using that code.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: kateibe

Please Log in to join the conversation.

More
3 years 10 months ago #95796 by kateibe
Hi Tony,

As always, thank you so much for your prompt response. I tried using the the code from the original posts but it is not working. :( Here is a test survey using the same template.

limesurvey.Partners.org/limesurvey/index.php/438423/lang-en

Thank you so much for all your help!

Regards,

Kat

Please Log in to join the conversation.

More
3 years 10 months ago - 3 years 10 months ago #95799 by tpartner
That's because jQuery isn't being loaded. The loading of JavaScript is handled differently in 2.0.

In startpage.pstpl, replace this:
<script type="text/javascript" src="{TEMPLATEURL}template.js"></script>

With this:
<!-- The following line includes jquery.js, jquery-ui.js, survey_runtime.js , template.js and needed specific js file for survey -->
{TEMPLATEJS}

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last Edit: 3 years 10 months ago by tpartner.
The following user(s) said Thank You: kateibe

Please Log in to join the conversation.

More
3 years 10 months ago #95811 by kateibe
Hi Tony!

Thank you so much for figuring this out! I would have never been able to! Thank you!! :woohoo:

with gratitude,

Kat

Please Log in to join the conversation.

More
3 years 2 weeks ago #105829 by katgatita
Hello Tony,

It's Kat again (I'm unable to access my old account). Is there a way to also make the "ranking" type questions change colors when any item is moved? I've tried to figure it out but to no avail. Thank you so much!

Kat

Please Log in to join the conversation.

More
3 years 2 weeks ago #105832 by tpartner
Hi Kat,

Add something like this to the end of templates.css.

.dragDropTable ul.dragDropChoiceList li.ui-sortable-helper, 
.dragDropTable ol.dragDropRankList li.ui-sortable-helper {
	background: pink;
	font-weight: bold;
	color: #CC0000;
}

.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: katgatita

Please Log in to join the conversation.

More
3 years 2 weeks ago #105836 by katgatita
Thank you for your prompt response Tony! I added the text as recommend but I may be missing something because it didn't work.

Here is a sample survey:
limesurvey.Partners.org/limesurvey/index.php/864121/lang-en

Thank you!

Kat

Please Log in to join the conversation.

More
3 years 2 weeks ago #105839 by tpartner
Please clear your cache and refresh.

Here is what I see when dragging:


Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Attachments:
The following user(s) said Thank You: katgatita

Please Log in to join the conversation.

More
3 years 2 weeks ago #105874 by katgatita
Hi Tony,

Thank you again for your response! I see that it does that in Internet explorer but not in Chrome (although that's not the real issue). What I'm really trying to do is to get the ranking questions to change color when answered, please see my example of the other question types here:

limesurvey.Partners.org/limesurvey/index.php/864121/lang-en

Thank you so much!

Kat

Please Log in to join the conversation.