From 20e6d78a10e1680a2868876838cf5c908fde0b2a Mon Sep 17 00:00:00 2001 From: jasquat Date: Tue, 9 May 2023 11:55:59 -0400 Subject: [PATCH] try adding a blank option for form selects w/ burnettk --- spiffworkflow-frontend/src/routes/TaskShow.tsx | 1 + .../src/themes/carbon/SelectWidget/SelectWidget.tsx | 7 ++----- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/spiffworkflow-frontend/src/routes/TaskShow.tsx b/spiffworkflow-frontend/src/routes/TaskShow.tsx index 3cddc676a..e8ec096de 100644 --- a/spiffworkflow-frontend/src/routes/TaskShow.tsx +++ b/spiffworkflow-frontend/src/routes/TaskShow.tsx @@ -267,6 +267,7 @@ export default function TaskShow() { formData: any, errors: any ) => { + console.log('errors', errors); if ('properties' in jsonSchema) { Object.keys(jsonSchema.properties).forEach((propertyKey: string) => { const propertyMetadata = jsonSchema.properties[propertyKey]; diff --git a/spiffworkflow-frontend/src/themes/carbon/SelectWidget/SelectWidget.tsx b/spiffworkflow-frontend/src/themes/carbon/SelectWidget/SelectWidget.tsx index 6f55ef1bf..102041450 100644 --- a/spiffworkflow-frontend/src/themes/carbon/SelectWidget/SelectWidget.tsx +++ b/spiffworkflow-frontend/src/themes/carbon/SelectWidget/SelectWidget.tsx @@ -60,11 +60,8 @@ function SelectWidget({ // this change causes chrome to also show the first option. now all browsers are consistent on our site. you no longer have to select anything. // setting the value prop causes it to show the first option. // calling onChange actually gets it set in the form data. - if (value === undefined) { - if (enumOptions) { - value = enumOptions[0].value; - onChange(value); - } + if (enumOptions && enumOptions[0].value !== '') { + enumOptions.unshift({ value: '', label: '' }); } // maybe use placeholder somehow. it was previously jammed into the helperText field,