Willkommen, Gast
Benutzername: Passwort: Angemeldet bleiben:

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

Bold current question or add a check mark when answered 1 Jahr 4 Monate her #94621

  • kateibe
  • kateibes Avatar
  • OFFLINE
  • Junior Lime
  • Beiträge: 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 :)
Anhang:
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Bold current question or add a check mark when answered 1 Jahr 4 Monate her #94652

  • tpartner
  • tpartners Avatar
  • OFFLINE
  • LimeSurvey Team
  • Beiträge: 4133
  • Dank erhalten: 763
  • Karma: 347
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.
Letzte Änderung: 1 Jahr 4 Monate her von tpartner.
Der Administrator hat öffentliche Schreibrechte deaktiviert.
Folgende Benutzer bedankten sich: kateibe

Bold current question or add a check mark when answered 1 Jahr 4 Monate her #94936

  • kateibe
  • kateibes Avatar
  • OFFLINE
  • Junior Lime
  • Beiträge: 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
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Bold current question or add a check mark when answered 1 Jahr 4 Monate her #94939

  • tpartner
  • tpartners Avatar
  • OFFLINE
  • LimeSurvey Team
  • Beiträge: 4133
  • Dank erhalten: 763
  • Karma: 347
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.
Der Administrator hat öffentliche Schreibrechte deaktiviert.
Folgende Benutzer bedankten sich: kateibe

Bold current question or add a check mark when answered 1 Jahr 4 Monate her #95062

  • kateibe
  • kateibes Avatar
  • OFFLINE
  • Junior Lime
  • Beiträge: 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
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Bold current question or add a check mark when answered 1 Jahr 3 Monate her #95794

  • kateibe
  • kateibes Avatar
  • OFFLINE
  • Junior Lime
  • Beiträge: 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
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Bold current question or add a check mark when answered 1 Jahr 3 Monate her #95795

  • tpartner
  • tpartners Avatar
  • OFFLINE
  • LimeSurvey Team
  • Beiträge: 4133
  • Dank erhalten: 763
  • Karma: 347
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.
Der Administrator hat öffentliche Schreibrechte deaktiviert.
Folgende Benutzer bedankten sich: kateibe

Bold current question or add a check mark when answered 1 Jahr 3 Monate her #95796

  • kateibe
  • kateibes Avatar
  • OFFLINE
  • Junior Lime
  • Beiträge: 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
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Bold current question or add a check mark when answered 1 Jahr 3 Monate her #95799

  • tpartner
  • tpartners Avatar
  • OFFLINE
  • LimeSurvey Team
  • Beiträge: 4133
  • Dank erhalten: 763
  • Karma: 347
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.
Letzte Änderung: 1 Jahr 3 Monate her von tpartner.
Der Administrator hat öffentliche Schreibrechte deaktiviert.
Folgende Benutzer bedankten sich: kateibe

Bold current question or add a check mark when answered 1 Jahr 3 Monate her #95811

  • kateibe
  • kateibes Avatar
  • OFFLINE
  • Junior Lime
  • Beiträge: 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
Der Administrator hat öffentliche Schreibrechte deaktiviert.
Moderatoren: ITEd
Ladezeit der Seite: 0.168 Sekunden
Donation Image