Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions frontend/editor/src/core/tools/formFill/FieldInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,11 @@ function FieldInputInner({
);

case "checkbox": {
const isChecked = !!value && value !== "Off";
const onValue = (field.widgets && field.widgets[0]?.exportValue) || "Yes";
const exportVal = field.widgets && field.widgets[0]?.exportValue;
const isChecked = exportVal
? value === exportVal
: !!value && value !== "Off";
const onValue = exportVal || "Yes";
Comment thread
balazs-szucs marked this conversation as resolved.
return (
<Checkbox
size="xs"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,9 +335,11 @@ function WidgetInputInner({
);

case "checkbox": {
// Checkbox is checked when value is anything other than 'Off' or empty
const isChecked = !!value && value !== "Off";
// When toggling on, use the widget's exportValue (e.g. 'Red', 'Blue') or fall back to 'Yes'
// Checkbox is checked when value matches exportValue if present, or is non-empty and not 'Off'
const isChecked = widget.exportValue
? value === widget.exportValue
: !!value && value !== "Off";
// When toggling on, use the widget's exportValue (e.g. 'Red', 'Blue', 'Pass') or fall back to 'Yes'
Comment thread
balazs-szucs marked this conversation as resolved.
const onValue = widget.exportValue || "Yes";
return (
<div
Expand Down Expand Up @@ -428,6 +430,7 @@ function WidgetInputInner({
multiple={field.multiSelect}
style={{
...inputBaseStyle,
minWidth: "100%",
padding: 0,
paddingLeft: 2,
appearance: "auto",
Expand Down
Loading