Translation question now checks if an answer is entered
This commit is contained in:
parent
1baeecb7fd
commit
bb42bdb947
1 changed files with 19 additions and 9 deletions
|
@ -10,6 +10,7 @@ package uk.ac.aber.cs221.group20.javafx;
|
|||
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.Alert;
|
||||
import javafx.scene.control.ComboBox;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.TextField;
|
||||
|
@ -123,6 +124,15 @@ public class TranslationController extends SharedCodeController {
|
|||
@FXML
|
||||
void translateWord() {
|
||||
|
||||
//Checks to ensure the user has entered a value
|
||||
if(translationBox.getText().equalsIgnoreCase("")){
|
||||
Alert alert = new Alert(Alert.AlertType.ERROR);
|
||||
alert.setTitle("Error");
|
||||
alert.setHeaderText("Please enter an answer");
|
||||
alert.setContentText("Please ensure you enter an answer before clicking submit.");
|
||||
alert.showAndWait();
|
||||
}else {
|
||||
|
||||
//Creates ArrayList of answers and ArrayList of user answers to check
|
||||
ArrayList<String> usersInput = new ArrayList<>();
|
||||
usersInput.add(translationBox.getText());
|
||||
|
@ -134,7 +144,7 @@ public class TranslationController extends SharedCodeController {
|
|||
|
||||
//Open the next question of the assessment.
|
||||
AssessmentGenerator.goToNextQuestion();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue