Transmit checkbox data as string in `Checked` form field
authorTim Düsterhus <duesterhus@woltlab.com>
Tue, 11 Apr 2023 13:56:01 +0000 (15:56 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Tue, 11 Apr 2023 13:56:01 +0000 (15:56 +0200)
This makes the “on-the-wire” representation consistent with regular forms.

see #5412

ts/WoltLabSuite/Core/Form/Builder/Field/Checked.ts
wcfsetup/install/files/js/WoltLabSuite/Core/Form/Builder/Field/Checked.js

index f526744a7d45b262e70c202f77f4d740d89e8593..1cfb0d22716cfddd1967486f32408fcb05bcb036 100644 (file)
@@ -14,7 +14,7 @@ import { FormBuilderData } from "../Data";
 class Checked extends Field {
   protected _getData(): FormBuilderData {
     return {
-      [this._fieldId]: (this._field as HTMLInputElement).checked ? 1 : 0,
+      [this._fieldId]: (this._field as HTMLInputElement).checked ? "1" : "0",
     };
   }
 }
index 55e76c8db456b009f0a62cd85884154d7a657edf..e00241e540936e2182f49d4190b677b74870ffbc 100644 (file)
@@ -13,7 +13,7 @@ define(["require", "exports", "tslib", "./Field"], function (require, exports, t
     class Checked extends Field_1.default {
         _getData() {
             return {
-                [this._fieldId]: this._field.checked ? 1 : 0,
+                [this._fieldId]: this._field.checked ? "1" : "0",
             };
         }
     }