diff --git a/src/core/xfa/template.js b/src/core/xfa/template.js index d4902039d..0c63c98bc 100644 --- a/src/core/xfa/template.js +++ b/src/core/xfa/template.js @@ -1265,8 +1265,8 @@ class CheckButton extends XFAObject { field.items.children[0][$toHTML]().html) || []; const exportedValue = { - on: (items[0] || "on").toString(), - off: (items[1] || "off").toString(), + on: (items[0] !== undefined ? items[0] : "on").toString(), + off: (items[1] !== undefined ? items[1] : "off").toString(), }; const value = (field.value && field.value[$text]()) || "off"; @@ -1296,6 +1296,7 @@ class CheckButton extends XFAObject { type, checked, xfaOn: exportedValue.on, + xfaOff: exportedValue.off, "aria-label": ariaLabel(field), }, }; diff --git a/src/display/xfa_layer.js b/src/display/xfa_layer.js index 5159a9fde..ab838a945 100644 --- a/src/display/xfa_layer.js +++ b/src/display/xfa_layer.js @@ -42,7 +42,11 @@ class XfaLayer { break; } html.addEventListener("change", event => { - storage.setValue(id, { value: event.target.getAttribute("xfaOn") }); + storage.setValue(id, { + value: event.target.checked + ? event.target.getAttribute("xfaOn") + : event.target.getAttribute("xfaOff"), + }); }); } else { if (storedData.value !== null) {