Skip to content
Snippets Groups Projects
Commit 778dfc53 authored by Richard Fernando Heise Ferreira's avatar Richard Fernando Heise Ferreira Committed by Stephanie Briere Americo
Browse files

Issue #74: Fix validation on backend

parent 24809502
No related branches found
No related tags found
No related merge requests found
...@@ -166,6 +166,19 @@ export class ValidationHandler { ...@@ -166,6 +166,19 @@ export class ValidationHandler {
private static validateInput(input: Input, inputAnswers: InputAnswerDict): string { private static validateInput(input: Input, inputAnswers: InputAnswerDict): string {
const errors: string[] = []; const errors: string[] = [];
let inputMandatory: boolean = false;
for (const val of input.validation) {
if (val.type === ValidationType.MANDATORY) {
inputMandatory = true;
break;
}
}
if ((inputAnswers[input.id] === undefined || inputAnswers[input.id][0].value === "") && !(inputMandatory)) {
return;
}
for (const validation of input.validation) { for (const validation of input.validation) {
switch (validation.type) { switch (validation.type) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment