Form field fixes

This commit is contained in:
Aarni Halinen
2020-07-25 00:18:11 +03:00
parent a867e7197d
commit dbefb353dc
2 changed files with 4 additions and 7 deletions
+3 -6
View File
@@ -98,11 +98,7 @@ class EventCreatePage extends React.Component<EventCreatePageProps, EventCreateP
}
onSubmit = async (data) => {
console.log("submitted, data:");
console.log(data.formData);
const { history } = this.props;
try {
const payload = data.formData;
if (typeof payload.image === "string" && payload.image.startsWith("http")) payload.image = undefined;
@@ -134,6 +130,7 @@ class EventCreatePage extends React.Component<EventCreatePageProps, EventCreateP
onError = (data) => {
console.error("error, data:");
console.log(this.state.formData);
console.log(data);
}
@@ -197,10 +194,10 @@ class EventCreatePage extends React.Component<EventCreatePageProps, EventCreateP
default: tomorrowDatetime,
},
signupForm: {
type: ["array"],
type: "array",
title: "Signup forms",
items: {
type: ["number", "null"],
type: "number",
// TODO: A bug here, DB must have at least one SignupForm, otherwise cannot submit
enum: signupForm.map(form => form.id),
enumNames: signupForm.map(form => form.title),
+1 -1
View File
@@ -44,7 +44,7 @@ class SignupCreatePage extends React.Component<SignupCreatePageProps, SignupCrea
fetchInitialFormData = async (id: number) => {
try {
const data = await getForm(id);
const data = await getForm(id, true);
this.setState({
formData: {
...data,