From 36373862c3c9017e5a4f19cadd417939385b164c Mon Sep 17 00:00:00 2001 From: Steven Bal Date: Tue, 12 Nov 2024 11:28:23 +0100 Subject: [PATCH] :bug: [open-formulieren/open-forms#4772] Fix select component with int values 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 --- src/formio/components/Select.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/formio/components/Select.js b/src/formio/components/Select.js index 468a10f35..82f8d4a89 100644 --- a/src/formio/components/Select.js +++ b/src/formio/components/Select.js @@ -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