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 committed Nov 11, 2024
1 parent 8b48584 commit ee4353f
Showing 1 changed file with 1 addition and 0 deletions.
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',

Check failure on line 180 in src/registry/select/edit.tsx

View workflow job for this annotation

GitHub Actions / Create 'production' build

Type '{ label: string; key: string; description: string; tooltip: string; showInSummary: true; showInEmail: false; showInPDF: true; hidden: false; clearOnHide: true; isSensitiveData: false; openForms: { dataSrc: "manual"; translations: {}; }; dataSrc: "values"; dataType: string; data: { values: { value: string; label: string; }[]; }; defaultValue: string; conditional: { show: undefined; when: string; eq: string; }; validate: { required: false; plugins: never[]; }; translatedErrors: {}; registration: { attribute: string; }; }' is not assignable to type 'Omit<{ defaultValue?: string | undefined; } & Omit<SelectManualValuesSchema, "openForms"> & Required<Pick<SelectManualValuesSchema, "openForms">> & Single<string>, "type" | "id"> | Omit<{ defaultValue?: string[] | undefined; } & Omit<SelectManualValuesSchema, "openForms"> & Required<Pick<SelectManualValuesSchema, "openForms">> & Multiple<string>, "type" | "id"> | Omit<{ defaultValue?: string | undefined; } & Omit<SelectVariableValuesSchema, "openForms"> & Required<Pick<SelectVariableValuesSchema, "openForms">> & Single<string>, "type" | "id"> | Omit<{ defaultValue?: string[] | undefined; } & Omit<SelectVariableValuesSchema, "openForms"> & Required<Pick<SelectVariableValuesSchema, "openForms">> & Multiple<string>, "type" | "id">'.
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 ee4353f

Please sign in to comment.