#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere
TypeScript dockerhacktoberfestjavapdfpdf-converterpdf-editorpdf-manipulationpdf-mergerpdf-ocrpdf-toolspdf-web-appspdfmergerself-hosted
fix(forms): Fix checkbox export values and wide dropdown options (#7288)
brios74be5bf0ad0b
diff --git a/frontend/editor/src/core/tools/formFill/FieldInput.tsx b/frontend/editor/src/core/tools/formFill/FieldInput.tsxindex 9662298dc4..9a8943ea47 100644--- a/frontend/editor/src/core/tools/formFill/FieldInput.tsx+++ b/frontend/editor/src/core/tools/formFill/FieldInput.tsx@@ -68,8 +68,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 === "Yes"+ : !!value && value !== "Off";+ const onValue = exportVal || "Yes";return (<Checkboxsize="xs"diff --git a/frontend/editor/src/core/tools/formFill/FormFieldOverlay.tsx b/frontend/editor/src/core/tools/formFill/FormFieldOverlay.tsxindex 40f9cdf603..45b658d69d 100644--- a/frontend/editor/src/core/tools/formFill/FormFieldOverlay.tsx+++ b/frontend/editor/src/core/tools/formFill/FormFieldOverlay.tsx@@ -338,9 +338,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 === "Yes"+ : !!value && value !== "Off";+ // When toggling on, use the widget's exportValue (e.g. 'Red', 'Blue', 'Pass') or fall back to 'Yes'const onValue = widget.exportValue || "Yes";return (<div@@ -433,6 +435,7 @@ function WidgetInputInner({multiple={field.multiSelect}style={{...inputBaseStyle,+ minWidth: "100%",padding: 0,paddingLeft: 2,appearance: "auto",diff --git a/frontend/editor/src/core/tools/formFill/providers/PdfiumFormProvider.ts b/frontend/editor/src/core/tools/formFill/providers/PdfiumFormProvider.tsindex 87d18c3f2f..471bba5e43 100644--- a/frontend/editor/src/core/tools/formFill/providers/PdfiumFormProvider.ts+++ b/frontend/editor/src/core/tools/formFill/providers/PdfiumFormProvider.ts@@ -92,7 +92,7 @@ function toFormField(// Derive value stringlet value = f.value;if (type === "checkbox") {- value = f.isChecked ? "Yes" : "Off";+ value = f.isChecked ? f.widgets[0]?.exportValue || "Yes" : "Off";} else if (type === "radio") {// Use widget index as the canonical radio value.// This avoids issues with duplicate exportValues across widgets