diff --git a/src/formio/components/select.ts b/src/formio/components/select.ts index 18a0314..e34f513 100644 --- a/src/formio/components/select.ts +++ b/src/formio/components/select.ts @@ -26,6 +26,10 @@ interface BaseSelectSchema { // dynamic values into data.values already. // So our openForms.dataSrc == itemsExpression results in dataSrc == values. dataSrc: 'values'; + // Fix for https://github.com/open-formulieren/open-forms/issues/4772 + // ensure the datatype is set to string to avoid formio casting it to other + // types (such as integer) + dataType: 'string'; } /** diff --git a/test-d/formio/components/select.test-d.ts b/test-d/formio/components/select.test-d.ts index 6802564..94d01ab 100644 --- a/test-d/formio/components/select.test-d.ts +++ b/test-d/formio/components/select.test-d.ts @@ -7,6 +7,7 @@ expectAssignable({ id: 'yejak', type: 'select', dataSrc: 'values', + dataType: 'string', key: 'someSelect', label: 'Some select', openForms: { @@ -28,6 +29,7 @@ expectAssignable({ id: 'yejak', type: 'select', dataSrc: 'values', + dataType: 'string', key: 'someSelect', label: 'Some select', openForms: { @@ -42,6 +44,7 @@ expectAssignable({ id: 'yejak', type: 'select', dataSrc: 'values', + dataType: 'string', key: 'someSelect', label: 'Some select', multiple: false, @@ -58,6 +61,7 @@ expectAssignable({ id: 'yejak', type: 'select', dataSrc: 'values', + dataType: 'string', key: 'someSelect', label: 'Some select', multiple: true, @@ -74,6 +78,7 @@ expectAssignable({ id: 'yejak', type: 'select', dataSrc: 'values', + dataType: 'string', key: 'someSelect', label: 'Some select', multiple: true, @@ -90,6 +95,7 @@ expectAssignable({ id: 'yejak', type: 'select', dataSrc: 'values', + dataType: 'string', key: 'someSelect', label: 'Some select', defaultValue: 'dummy', @@ -122,6 +128,7 @@ expectAssignable({ id: 'yejak', type: 'select', dataSrc: 'values', + dataType: 'string', // basic tab label: 'Some select', key: 'someSelect',