From 39fe1ece1366c70f2d139a7a8bec9eec2c41d1da Mon Sep 17 00:00:00 2001
From: ks129 <45097959+ks129@users.noreply.github.com>
Date: Mon, 8 Feb 2021 16:23:55 +0200
Subject: Use public state instead of event value for compability

---
 src/components/Question.tsx | 22 +++-------------------
 1 file changed, 3 insertions(+), 19 deletions(-)

(limited to 'src/components/Question.tsx')

diff --git a/src/components/Question.tsx b/src/components/Question.tsx
index 25ce04d..567da2c 100644
--- a/src/components/Question.tsx
+++ b/src/components/Question.tsx
@@ -1,6 +1,6 @@
 /** @jsx jsx */
 import { jsx, css } from "@emotion/react";
-import React, { ChangeEvent, FocusEvent } from "react";
+import React, { ChangeEvent } from "react";
 
 import { Question, QuestionType } from "../api/question";
 import { selectable } from "../commonStyles";
@@ -47,25 +47,9 @@ class RenderedQuestion extends React.Component<QuestionProp> {
     // This is here to allow dynamic selection between the general handler, and the textarea handler.
     handler(_: ChangeEvent<HTMLInputElement | HTMLTextAreaElement>): void {} // eslint-disable-line
 
-    blurHandler(event: FocusEvent<HTMLInputElement | HTMLTextAreaElement | HTMLDivElement>): void {
+    blurHandler(): void {
         if (this.props.question.required) {
-            let invalid = false;
-            switch (this.props.question.type) {
-                case QuestionType.ShortText:   
-                case QuestionType.TextArea:
-                    if (event.target.value === "") {
-                        invalid = true;
-                    }
-                    break;
-                
-                case QuestionType.Select:
-                    if (!this.props.public_state.get("value")) {
-                        invalid = true;
-                    }
-                    break;
-            }
-
-            if (invalid) {
+            if (!this.props.public_state.get("value")) {
                 this.setPublicState("error", "Field must be filled.");
                 this.setPublicState("valid", false);
             } else {
-- 
cgit v1.2.3

