Check out the LimeSurvey source code on GitHub!
Welcome, Guest
Username: Password:

TOPIC: Bold current question or add a check mark when answered

Bold current question or add a check mark when answered 3 years 7 months ago #94621

  • kateibe
  • kateibe's Avatar
  • Offline
  • Junior Lime
  • Posts: 23
  • Karma: 0
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:
The administrator has disabled public write access.

Bold current question or add a check mark when answered 3 years 7 months ago #94652

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 6566
  • Thank you received: 1477
  • Karma: 578
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 7 months ago by tpartner.
The administrator has disabled public write access.
The following user(s) said Thank You: kateibe

Bold current question or add a check mark when answered 3 years 7 months ago #94936

  • kateibe
  • kateibe's Avatar
  • Offline
  • Junior Lime
  • Posts: 23
  • Karma: 0
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
The administrator has disabled public write access.

Bold current question or add a check mark when answered 3 years 7 months ago #94939

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 6566
  • Thank you received: 1477
  • Karma: 578
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 administrator has disabled public write access.
The following user(s) said Thank You: kateibe

Bold current question or add a check mark when answered 3 years 7 months ago #95062

  • kateibe
  • kateibe's Avatar
  • Offline
  • Junior Lime
  • Posts: 23
  • Karma: 0
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
The administrator has disabled public write access.

Bold current question or add a check mark when answered 3 years 6 months ago #95794

  • kateibe
  • kateibe's Avatar
  • Offline
  • Junior Lime
  • Posts: 23
  • Karma: 0
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
The administrator has disabled public write access.

Bold current question or add a check mark when answered 3 years 6 months ago #95795

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 6566
  • Thank you received: 1477
  • Karma: 578
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 administrator has disabled public write access.
The following user(s) said Thank You: kateibe

Bold current question or add a check mark when answered 3 years 6 months ago #95796

  • kateibe
  • kateibe's Avatar
  • Offline
  • Junior Lime
  • Posts: 23
  • Karma: 0
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
The administrator has disabled public write access.

Bold current question or add a check mark when answered 3 years 6 months ago #95799

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 6566
  • Thank you received: 1477
  • Karma: 578
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 6 months ago by tpartner.
The administrator has disabled public write access.
The following user(s) said Thank You: kateibe

Bold current question or add a check mark when answered 3 years 6 months ago #95811

  • kateibe
  • kateibe's Avatar
  • Offline
  • Junior Lime
  • Posts: 23
  • Karma: 0
Hi Tony!

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

with gratitude,

Kat
The administrator has disabled public write access.

Bold current question or add a check mark when answered 2 years 8 months ago #105829

  • katgatita
  • katgatita's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 10
  • Karma: 0
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
The administrator has disabled public write access.

Bold current question or add a check mark when answered 2 years 8 months ago #105832

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 6566
  • Thank you received: 1477
  • Karma: 578
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 administrator has disabled public write access.
The following user(s) said Thank You: katgatita

Bold current question or add a check mark when answered 2 years 8 months ago #105836

  • katgatita
  • katgatita's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 10
  • Karma: 0
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
The administrator has disabled public write access.

Bold current question or add a check mark when answered 2 years 8 months ago #105839

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 6566
  • Thank you received: 1477
  • Karma: 578
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.
The administrator has disabled public write access.
The following user(s) said Thank You: katgatita

Bold current question or add a check mark when answered 2 years 8 months ago #105874

  • katgatita
  • katgatita's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 10
  • Karma: 0
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
The administrator has disabled public write access.
Time to create page: 0.826 seconds
Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form