Skip to content

Commit

Permalink
🐛 [open-formulieren/open-forms#4772] Set select dataType to string
Browse files Browse the repository at this point in the history
because Select components did not have a dataType set, formio tries to cast it to other types if possible, which causes issues when submitting the data to the backend. For that reason we set the value to string to avoid this unwanted normalization
  • Loading branch information
stevenbal authored and sergei-maertens committed Nov 12, 2024
1 parent 2b5adeb commit f514254
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"@formatjs/cli": "^6.1.1",
"@formatjs/ts-transformer": "^3.12.0",
"@fortawesome/fontawesome-free": "^6.4.0",
"@open-formulieren/types": "^0.33.0",
"@open-formulieren/types": "^0.34.0",
"@storybook/addon-actions": "^8.3.5",
"@storybook/addon-essentials": "^8.3.5",
"@storybook/addon-interactions": "^8.3.5",
Expand Down
2 changes: 2 additions & 0 deletions src/components/ComponentConfiguration.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1626,6 +1626,7 @@ export const Select: Story = {
clearOnHide: true,
isSensitiveData: false,
dataSrc: 'values',
dataType: 'string',
data: {
values: [
{
Expand Down Expand Up @@ -1726,6 +1727,7 @@ export const Select: Story = {
clearOnHide: true,
isSensitiveData: false,
dataSrc: 'values',
dataType: 'string',
data: {},
openForms: {
dataSrc: 'variable',
Expand Down
1 change: 1 addition & 0 deletions src/registry/select/edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ EditForm.defaultValues = {
// fixed, this is what itemsExpression results in via the backend. Do not confuse with
// openForms.dataSrc!
dataSrc: 'values',
dataType: 'string',
data: {values: [{value: '', label: ''}]},
// TODO: at some point we can allow an itemsExpression for this too
// Note: Formio will override this to `null`! So be careful when dealing with
Expand Down

0 comments on commit f514254

Please sign in to comment.