mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-12 00:28:11 +00:00
fix bug: checkbox/radio/switch/.values
This commit is contained in:
parent
0b568d6b40
commit
1d36cdaaa3
@ -128,7 +128,7 @@ var schema = {
|
||||
checked = document.getElementById(product.id).checked;
|
||||
if (checked) {
|
||||
flag = true;
|
||||
value["Answers Chosen"].push(product.label);
|
||||
value["Answers Chosen"].push(product.value);
|
||||
}
|
||||
if (product.correct != checked)
|
||||
asExpected = false;
|
||||
@ -1234,7 +1234,9 @@ Dropdown.prototype._option_factory = function() {
|
||||
|
||||
for (var i in item.labels) {
|
||||
if (item.values.length < item.labels.length)
|
||||
item.values = [item.labels[i]] + item.values;
|
||||
item.values.push(item.labels[i]);
|
||||
else
|
||||
break;
|
||||
}
|
||||
if (item.images.length > 0) {
|
||||
for (var i in item.images) {
|
||||
@ -1258,9 +1260,9 @@ Dropdown.prototype._option_factory = function() {
|
||||
item.label = this.labels[i];
|
||||
item.value = this.values[i];
|
||||
item.id = ""; // initialize item.id
|
||||
if (this.correctAnswers[item.label] == undefined)
|
||||
this.correctAnswers[item.label] = false;
|
||||
item.correct = this.correctAnswers[item.label];
|
||||
if (this.correctAnswers[item.value] == undefined)
|
||||
this.correctAnswers[item.value] = false;
|
||||
item.correct = this.correctAnswers[item.value];
|
||||
product = factory(this.parent_id, item);
|
||||
this.products.push(product);
|
||||
this.html += product.html + "\n";
|
||||
|
@ -26,7 +26,7 @@
|
||||
form: {form_title: 'Test #1', ribbon_bg: "img/ribbon.jpg", layout_color: "grey-300", content_bg_color: "grey-100"},
|
||||
"Question #1": {type: "short answer", correct: "Answer #1", required: true},
|
||||
"Question #2": {type: "password"},
|
||||
"Question #3": {type: "checkbox", labels: ["option1", "option2"], correctAnswers: ["option1", "option2"]},
|
||||
"Question #3": {type: "checkbox", labels: ["option1", "option2"], correctAnswers: ["value1", "value2"], values:["value1", "value2"]},
|
||||
"Question #4": {type: "radio", labels: ["option1", "option2"], correctAnswers: ["option1"]},
|
||||
"Question #5": {type: "range"},
|
||||
"Question #6": {type: "dropdown"},
|
||||
|
Loading…
Reference in New Issue
Block a user