Welcome, Guest
Username: Password: Remember me

TOPIC: Show question/group number in randomized groups

Show question/group number in randomized groups 3 years 3 months ago #64147

  • flink
  • flink's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 23
  • Karma: 0
Hey there,

my Problem is as follows: I set up a questionnaire with 20 items. Every item is actually a group containing 3 questions. One is the actual item and the other two are hidden questions that control time recording and right/wrong counting. The group order is completely randomized by using the _rand()-trick.

What I want to do now is tell the respondet something like "you are currently answering item 12/20". I would normally do that by simply putting this text into the group description (as every group is one item). But since the group order is completely randomized this solution won't work.

Is there any way to realize that? Or, lets say, I'm pretty sure there is a way, because LimeSurvey can literally do everything, but is there somebody who knows how to get it to work?

Thanks in advance and best regards

Flink
The administrator has disabled public write access.

Re: Show question/group number in randomized groups 3 years 3 months ago #64178

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4364
  • Thank you received: 827
  • Karma: 381
There is a hidden field containing the step number of the displayed group so the following should return the step number:
document.write($('#thisstep').val());
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.

Re: Show question/group number in randomized groups 3 years 3 months ago #64212

  • flink
  • flink's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 23
  • Karma: 0
Hey tpartner,

thank you for your answer. Unfortunately, your code only returns "undefined" when I put it into the group description. What am I doing wrong?

Regards

Flink
The administrator has disabled public write access.

Re: Show question/group number in randomized groups 3 years 3 months ago #64235

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4364
  • Thank you received: 827
  • Karma: 381
Can you activate a sample 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.
The administrator has disabled public write access.

Re: Show question/group number in randomized groups 3 years 3 months ago #64237

  • flink
  • flink's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 23
  • Karma: 0
yes I can. Should I activate it and send you a link, or what do you mean?
The administrator has disabled public write access.

Re: Show question/group number in randomized groups 3 years 3 months ago #64258

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4364
  • Thank you received: 827
  • Karma: 381
Sure, you can PM me a link or just post it here if it's a sample 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.
The administrator has disabled public write access.

Re: Show question/group number in randomized groups 3 years 3 months ago #64327

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4364
  • Thank you received: 827
  • Karma: 381
Ah, it looks like we need to introduce a small delay to allow the form to render.

If using the default template, try:
<script type="text/javascript" charset="utf-8">
 
	$(document).ready(function() {
 
		// A small delay to allow the form to render
		setTimeout(function() {
 
			$('.group-description').prepend('<p>Step '+$('#thisstep').val()+'/10</p>');
 
		}, 500);
 
	});
 
</script>
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: 3 years 3 months ago by tpartner.
The administrator has disabled public write access.

Re: Show question/group number in randomized groups 3 years 3 months ago #64368

  • flink
  • flink's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 23
  • Karma: 0
It works! Thank you very much! :)
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.134 seconds
Donation Image