Skip to content
Snippets Groups Projects
Commit 8b6e2f14 authored by Ben Whitmore's avatar Ben Whitmore
Browse files

fix(form-builder): empty rich text fields should not show 'undefined'

Resolves #165.
parent 3d05608d
No related branches found
No related tags found
No related merge requests found
Pipeline #18452 failed with stage
in 0 seconds
...@@ -41,7 +41,11 @@ const ComponentProperties = ({ ...@@ -41,7 +41,11 @@ const ComponentProperties = ({
{selectedComponent && {selectedComponent &&
map(components[selectedComponent], (value, key) => ( map(components[selectedComponent], (value, key) => (
<Section key={key}> <Section key={key}>
<Legend space>{`Field ${key === 'DoiValidation' ? components[selectedComponent][key].props.label : key}`}</Legend> <Legend space>{`Field ${
key === 'DoiValidation'
? components[selectedComponent][key].props.label
: key
}`}</Legend>
<ValidatedFieldFormik <ValidatedFieldFormik
component={elements[value.component].default} component={elements[value.component].default}
key={`${selectedComponent}-${key}`} key={`${selectedComponent}-${key}`}
...@@ -116,7 +120,11 @@ const ComponentForm = ({ ...@@ -116,7 +120,11 @@ const ComponentForm = ({
if (!isField) if (!isField)
return ( return (
<Formik <Formik
initialValues={fieldOrForm} initialValues={{
description: '',
popupdescription: '',
...fieldOrForm,
}}
onSubmit={values => onSubmit={values =>
updateForm({ updateForm({
variables: { formId: values.id, form: prepareForSubmit(values) }, variables: { formId: values.id, form: prepareForSubmit(values) },
...@@ -135,7 +143,7 @@ const ComponentForm = ({ ...@@ -135,7 +143,7 @@ const ComponentForm = ({
return ( return (
<Formik <Formik
initialValues={{ options: [], ...fieldOrForm }} initialValues={{ options: [], description: '', ...fieldOrForm }}
key={fieldOrForm.id} key={fieldOrForm.id}
onSubmit={values => onSubmit={values =>
updateField({ updateField({
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment