Welcome, Guest
Username: Password: Remember me

TOPIC: Multiple assessment values for multiple-choice question.

Multiple assessment values for multiple-choice question. 10 months 1 week ago #103781

  • Ben_V
  • Ben_V's Avatar
  • OFFLINE
  • Platinum Lime
  • Posts: 1155
  • Thank you received: 274
  • Karma: 79
Hello,

Since LS 1.90 it's not possible to set separately assessment values. This value is the same for all answer options and have to be set in the advanced settings of the question.

I suppose that it won't be a hard task to retrieve the correct score using an equation type question (equation may need a long expression depending on the items number ->see attached img), but is there a way to achieve this using javascript?

Many thanks for any help you can provide...

Ben
Attachments:
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: 10 months 1 week ago by Ben_V.
The administrator has disabled public write access.

Multiple assessment values for multiple-choice question. 10 months 1 week ago #103786

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4372
  • Thank you received: 830
  • Karma: 381
Hi Ben,

The easiest approach with JavaScript would probably be to append the score value to the answer codes. Then on page submit, we could detect which items are checked, add those scores and load them in a hidden text question. (I assume the scored question would be a multiple-choice)

Is this more or less what you're after?
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.

Multiple assessment values for multiple-choice question. 10 months 1 week ago #103791

  • Ben_V
  • Ben_V's Avatar
  • OFFLINE
  • Platinum Lime
  • Posts: 1155
  • Thank you received: 274
  • Karma: 79
Thanks Tony,

Yes your approach looks great...

if answer options are (code/points):

opt11 :1 point
opt12: 1 point
opt21: 2 points
opt22: 2 points
opt31: 3 points
opt32: 3 points


the overall assessment value have to be 0 (and the js code will refer to all answer options)
...or it's possible to use for example "1" and set the js only for options scoring 2 or 3 points ?
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: 10 months 1 week ago by Ben_V.
The administrator has disabled public write access.

Multiple assessment values for multiple-choice question. 10 months 1 week ago #103794

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4372
  • Thank you received: 830
  • Karma: 381
The overall assessment value wouldn't matter because this workaround wouldn't use the built-in assessments at all. Any assessment message(s) would need to be generated by Expression Manager depending on the value of the hidden question.

I'll get an example to you later today.

Another question...would you need this to be dynamic on this page or would it just affect a message or something later in the 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.

Multiple assessment values for multiple-choice question. 10 months 1 week ago #103800

  • Ben_V
  • Ben_V's Avatar
  • OFFLINE
  • Platinum Lime
  • Posts: 1155
  • Thank you received: 274
  • Karma: 79
Thanks again Tony,

I just need to retrieve the total score for this question.. so I don't need nothing dynamic on the page

I was planning a 2 groups question (survey display: group by group):

Group 1:
- Q1 the multiple-choice question.

Group 2:
- Qscore (numerical)


When all this will be working, I will add a radio type question (if possible in group 2) to retrieve an assessment based on the Qscore question.
In fact I don't use EM to grab this assessment into the db, but a prefilled radio question.
something like:
$(document).ready(function() {
var ACT = '{assessment_CURRENT_TOTAL}';
var SGQ = '10002X65X1215'; // LS < 1.91
// var SGQ = '{SGQ}';      // LS > 1.92
if(ACT == 0) document.getElementById('answer'+SGQ+'A0').checked=true;
if(ACT == 2) document.getElementById('answer'+SGQ+'A1').checked=true;
if(ACT >= 3) document.getElementById('answer'+SGQ+'A2').checked=true;
// document.limesurvey.submit();
});



PS: it's not an urgent matter at all...
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: 10 months 1 week ago by Ben_V.
The administrator has disabled public write access.

Multiple assessment values for multiple-choice question. 10 months 1 week ago #103823

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4372
  • Thank you received: 830
  • Karma: 381
Okay, so here is a test survey.

In group 1, there is a multiple-choice followed by a short-text (note that the short-text must be place directly after the multiple-choice).

"Scores" are appended to the sub-question codes of the multiple-choice.

The short-text contains the script below that:
- Hides the short-text
- Puts a listener on the multiple-choice checkboxes
- When a checkbox is changed, the scores for all checked options are totaled and loaded into the short-text.

Group 2 simply contains a text-display question that presents the score.

<script type="text/javascript" charset="utf-8">
 
	$(document).ready(function() {
 
		// Identify the questions
		var qID = {QID};
		var thisQuestion = $('#question'+qID);
		var prevMultiChoice = $(thisQuestion).prevAll('.multiple-opt:eq(0)');
 
		// Hide this question
		$('#question'+qID).hide();
 
		// Find the initial score
		var totalScore = 0;
		$('input.checkbox:checked', prevMultiChoice).each(function(i) {
			var thisScore = $(this).attr('id').slice(-1);
			totalScore = totalScore + Number(thisScore);
		});
		// Store the score
		$('input[type="text"]', thisQuestion).val(totalScore);
 
		// Listener on the checkboxes
		$('input.checkbox', prevMultiChoice).change(function(event) {
			// Find the score
			totalScore = 0;
			$('input.checkbox:checked', prevMultiChoice).each(function(i) {
				var thisScore = $(this).attr('id').slice(-1);
				totalScore = totalScore + Number(thisScore);
			});
			// Store the score
			$('input[type="text"]', thisQuestion).val(totalScore);
		}); 
	});
 
</script>

File Attachment:

File Name: limesurvey_survey_981968.lss
File Size: 19 KB


.
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: Ben_V

Multiple assessment values for multiple-choice question. 10 months 1 week ago #103824

  • Ben_V
  • Ben_V's Avatar
  • OFFLINE
  • Platinum Lime
  • Posts: 1155
  • Thank you received: 274
  • Karma: 79
:)
Tony, I don't know what to say... only it's really genial and that I won't regret LS 1.87 anymore !

Hope that your nice sample will help some other users.

The good extra surprise is that very few lines of code are needed.

Thanks a lot, again.
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...
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.159 seconds
Donation Image