diff options
Diffstat (limited to 'src/components/Question.tsx')
-rw-r--r-- | src/components/Question.tsx | 22 |
1 files changed, 3 insertions, 19 deletions
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 { |