Commit 3898b9e6 authored by Dennis Schönhof's avatar Dennis Schönhof
Browse files

Validate freetext answer

parent aa153f31
......@@ -174,6 +174,7 @@ Ext.define("ARSnova.controller.Questions", {
var subjectError = false;
var checkedError = false;
var questionError = false;
var freetextError = false;
var validation = question.validate();
if (!validation.isValid()) {
......@@ -247,6 +248,11 @@ Ext.define("ARSnova.controller.Questions", {
gridError = true;
}
break;
case 'freetext':
if (question.data.fixedAnswer && question.data.correctAnswer.trim() === "") {
freetextError = true;
}
break;
}
if (error) {
......@@ -263,6 +269,9 @@ Ext.define("ARSnova.controller.Questions", {
}
if (answersError && question.get('questionType') === 'flashcard') {
message += '<li>' + Messages.MISSING_FLASHCARD + '</li>';
}
if (freetextError) {
message += '<li>' + Messages.MISSING_FREETEXT_ANSWER + '</li>';
} else if (answersError) {
message += '<li>' + Messages.MISSING_ANSWERS + '</li>';
}
......
......@@ -466,6 +466,7 @@
MISSING_ANSWERS: "Es fehlen Antwortoptionen",
MISSING_IMAGE: "Es wurde kein Bild hochgeladen",
MISSING_FLASHCARD: "Die Rückseite ist leer",
MISSING_FREETEXT_ANSWER: "Freitext Antwort fehlt",
EXPECT_ANSWER_TEXT: "Textantwort zulassen?",
TEXT_CHECKER_TITLE: 'Art der Antwort:',
TEXT_CHECKER_FREETEXT: 'Freie Antwort',
......@@ -1300,6 +1301,7 @@
MISSING_ANSWERS: "Some answer options are missing",
MISSING_IMAGE: "No picture has been uploaded",
MISSING_FLASHCARD: "The back page text is missing",
MISSING_FREETEXT_ANSWER: "Freetext answer is missing",
TEXT_CHECKER_TITLE: 'Type of answer',
TEXT_CHECKER_FREETEXT: 'Freetext',
TEXT_CHECKER_ADD_SOLUTION: 'Add solution',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment