Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1
  • 2

TOPIC: Display assessment results before end of survey

Re: Display assessment results before end of survey 2 years 9 months ago #69780

  • Ben_V
  • Ben_V's Avatar
  • OFFLINE
  • Platinum Lime
  • Posts: 1068
  • Thank you received: 235
  • Karma: 74
Jannet...
I forget to tell you the "why" of my so complicated method :silly: : I use it or some similar code when I need to get both assessmt. values and messages written into the db!
Remember it in case of further need !

Good luck and give us some feedback soon !
Benoît

goo.gl/Bw5iM => Recherche GG dans le forum français (remplacer "exemple" dans la barre de recherche)
goo.gl/WX8PH => GG search for english forum (Replace "example" in the search bar)
goo.gl/IxiGu => Búsqueda en el foro en español (Cambiar "ejemplo" en la barra de...
Last Edit: 2 years 9 months ago by Ben_V.
The administrator has disabled public write access.

Re: Display assessment results before end of survey 2 years 9 months ago #69784

  • Jannet
  • Jannet's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 25
  • Karma: 0
@tpartner: Quick question: does the first piece of code go inside the script tag or before the script tag. I guess inside?
Last Edit: 2 years 9 months ago by Jannet.
The administrator has disabled public write access.

Re: Display assessment results before end of survey 2 years 9 months ago #69786

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4139
  • Thank you received: 767
  • Karma: 348
The first snippet goes before or after the <script> tag. So combined, it would be:
<p class="msgRed assmtMsg">
	This is the "Red" assesssment message.
</p>
<p class="msgOrange assmtMsg">
	This is the "Orange" assesssment message.
</p>
<p class="msgGreen assmtMsg">
	This is the "Green" assesssment message.
</p>
 
<script type="text/javascript" charset="utf-8">
 
	$(document).ready(function() {
 
		// Hide all messages	
		$('.assmtMsg').hide();
 
		// Get the assesssment value
		var assmt = '{assessment_CURRENT_TOTAL}';
 
		// Hide the question answer element (NOTE: this selector is for the default template)	
		$('.text-short td.answer').parent().hide();
 
		// Load the assesssment into the short-text	
		$('.text-short input.text').val(assmt);
 
		// Show the appropriate message
		if(assmt == 0) {
			$('.msgRed').show();
		}
		else if(assmt > 0 && assmt < 50) {
			$('.msgOrange').show();
		}
		else {
			$('.msgGreen').show();
		}
 
	});
</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.
The administrator has disabled public write access.

Re: Display assessment results before end of survey 2 years 9 months ago #69799

  • Jannet
  • Jannet's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 25
  • Karma: 0
Super! It works like clockwork! (But off course you already knew that). Thanks again.

Now I have to tweek my messages to work like I want. Also I am not using the default template, so have to see how the answer element that you switched off is called in my template.
The administrator has disabled public write access.

Re: Display assessment results before end of survey 2 years 9 months ago #69804

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4139
  • Thank you received: 767
  • Karma: 348
...so have to see how the answer element that you switched off is called in my template.
If you have problems, activate a sample survey and I'll give you the correct selector.
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: Display assessment results before end of survey 2 years 9 months ago #69808

  • Jannet
  • Jannet's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 25
  • Karma: 0
@tpartner Figured that out already. But thanks.
The administrator has disabled public write access.

Re: Display assessment results before end of survey 2 years 9 months ago #69852

  • Mazi
  • Mazi's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 5324
  • Thank you received: 294
  • Karma: 249
You're welcome!

Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)limesurvey.org'"
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Moderators: ITEd
Time to create page: 0.141 seconds
Donation Image