Name question fields

This commit is contained in:
Aarni Halinen
2020-07-24 00:41:26 +03:00
parent c94137bafd
commit b6230fb6aa
3 changed files with 7 additions and 5 deletions
@@ -44,7 +44,7 @@ class OptionsWidget extends React.Component<OptionsWidgetProps, OptionsWidgetSta
throw new SignupQuestionError(`Question widget type "${type}" not in types array.`);
}
if (type === "text" || type === "email") {
if (type === "text" || type === "email" || type === "name") {
return null;
}
@@ -20,7 +20,8 @@ type OptionTypes =
"integer" |
"radiobutton" |
"checkbox" |
"email";
"email" |
"name";
export const optionTypes = [
"text",
@@ -28,7 +29,8 @@ export const optionTypes = [
"integer",
"radiobutton",
"checkbox",
"email"
"email",
"name"
];
export class SignupQuestionError extends Error { }
+2 -2
View File
@@ -5,7 +5,7 @@ import { EMAIL_REGEX } from "@utils/regexes";
const questionToSchemaProp = (question: Question): {} => {
let obj: any;
if (question.type === "text") {
if (question.type === "text" || question.type === "name") {
obj = {
type: "string",
title: question.name,
@@ -104,7 +104,7 @@ const questionToUISchemaProp = (question: Question): {} => {
}
const questionToValidationSchema = (question: Question) => {
if (question.type === "text") {
if (question.type === "text" || question.type === "name") {
return {
type: "string",
};