Skip to content

Commit

Permalink
🐛 [open-formulieren/open-forms#4772] Fix select component with int va…
Browse files Browse the repository at this point in the history
…lues

because Select components do not have a dataType set, formio will try 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 12, 2024
1 parent f3f74d7 commit 183826b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/formio/components/Select.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ import {applyPrefix} from '../utils';
* Extend the default select field to modify it to our needs.
*/
class Select extends Formio.Components.components.select {
constructor(component, options, data) {
super(component, options, data);
// Fix for https://github.com/open-formulieren/open-forms/issues/4772
// ensure the datatype is always set to string to avoid formio casting it to other
// types (such as integer)
component.dataType = 'string';
}

get inputInfo() {
const info = super.inputInfo;
// change the default CSS classes
Expand Down

0 comments on commit 183826b

Please sign in to comment.