Check out the LimeSurvey source code on GitHub!
Welcome, Guest
Username: Password:
  • Page:
  • 1
  • 2

TOPIC: Display assessment results before end of survey

Display assessment results before end of survey 4 years 10 months ago #69780

  • Ben_V
  • Ben_V's Avatar
  • Offline
  • Platinum Lime
  • Posts: 1826
  • Thank you received: 449
  • Karma: 111
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

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
All LS releases => bit.ly/1VMuTDu | 2.06lts => bit.ly/1Qv44A1
Demo surveys => bit.ly/20NW9V8 (already included in /docs/demosurveys)
Last Edit: 4 years 10 months ago by Ben_V.
The administrator has disabled public write access.

Display assessment results before end of survey 4 years 10 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: 4 years 10 months ago by Jannet.
The administrator has disabled public write access.

Display assessment results before end of survey 4 years 10 months ago #69786

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 6321
  • Thank you received: 1407
  • Karma: 547
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.
The administrator has disabled public write access.

Display assessment results before end of survey 4 years 10 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.

Display assessment results before end of survey 4 years 10 months ago #69804

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 6321
  • Thank you received: 1407
  • Karma: 547
...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.
The administrator has disabled public write access.

Display assessment results before end of survey 4 years 10 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.

Display assessment results before end of survey 4 years 10 months ago #69852

  • Mazi
  • Mazi's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 6009
  • Thank you received: 371
  • Karma: 260
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
Time to create page: 0.279 seconds
Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form