Welcome, Guest
Username: Password: Remember me

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

Bold current question or add a check mark when answered 1 year 1 week ago #94621

  • kateibe
  • kateibe's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 21
  • 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 1 year 1 week ago #94652

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 3813
  • Thank you received: 683
  • Karma: 328
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.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
Last Edit: 1 year 1 week 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 1 year 2 days ago #94936

  • kateibe
  • kateibe's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 21
  • 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 1 year 2 days ago #94939

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 3813
  • Thank you received: 683
  • Karma: 328
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.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
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 11 months 4 weeks ago #95062

  • kateibe
  • kateibe's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 21
  • 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 11 months 1 week ago #95794

  • kateibe
  • kateibe's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 21
  • 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 11 months 1 week ago #95795

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 3813
  • Thank you received: 683
  • Karma: 328
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.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
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 11 months 1 week ago #95796

  • kateibe
  • kateibe's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 21
  • 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 11 months 1 week ago #95799

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 3813
  • Thank you received: 683
  • Karma: 328
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.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
Last Edit: 11 months 1 week 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 11 months 1 week ago #95811

  • kateibe
  • kateibe's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 21
  • 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.
Moderators: ITEd
Time to create page: 0.125 seconds
Donation Image