Skip to content

Commit

Permalink
Merge pull request #58 from open-formulieren/issue/4772-select-compon…
Browse files Browse the repository at this point in the history
…ent-datatype-string

🐛 [open-formulieren/open-forms#4772] Set select dataType to string
  • Loading branch information
sergei-maertens authored Nov 12, 2024
2 parents 4bd994b + a638bf3 commit 6af97da
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/formio/components/select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}

/**
Expand Down
7 changes: 7 additions & 0 deletions test-d/formio/components/select.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ expectAssignable<SelectComponentSchema>({
id: 'yejak',
type: 'select',
dataSrc: 'values',
dataType: 'string',
key: 'someSelect',
label: 'Some select',
openForms: {
Expand All @@ -28,6 +29,7 @@ expectAssignable<SelectComponentSchema>({
id: 'yejak',
type: 'select',
dataSrc: 'values',
dataType: 'string',
key: 'someSelect',
label: 'Some select',
openForms: {
Expand All @@ -42,6 +44,7 @@ expectAssignable<SelectComponentSchema>({
id: 'yejak',
type: 'select',
dataSrc: 'values',
dataType: 'string',
key: 'someSelect',
label: 'Some select',
multiple: false,
Expand All @@ -58,6 +61,7 @@ expectAssignable<SelectComponentSchema>({
id: 'yejak',
type: 'select',
dataSrc: 'values',
dataType: 'string',
key: 'someSelect',
label: 'Some select',
multiple: true,
Expand All @@ -74,6 +78,7 @@ expectAssignable<SelectComponentSchema>({
id: 'yejak',
type: 'select',
dataSrc: 'values',
dataType: 'string',
key: 'someSelect',
label: 'Some select',
multiple: true,
Expand All @@ -90,6 +95,7 @@ expectAssignable<SelectComponentSchema>({
id: 'yejak',
type: 'select',
dataSrc: 'values',
dataType: 'string',
key: 'someSelect',
label: 'Some select',
defaultValue: 'dummy',
Expand Down Expand Up @@ -122,6 +128,7 @@ expectAssignable<SelectComponentSchema>({
id: 'yejak',
type: 'select',
dataSrc: 'values',
dataType: 'string',
// basic tab
label: 'Some select',
key: 'someSelect',
Expand Down

0 comments on commit 6af97da

Please sign in to comment.