Fix saving of XFA checkboxes. (bug 1726381)
Previously were were always setting the storage value to the on value.
This commit is contained in:
parent
56e7bb626c
commit
6d2193a812
@ -1265,8 +1265,8 @@ class CheckButton extends XFAObject {
|
|||||||
field.items.children[0][$toHTML]().html) ||
|
field.items.children[0][$toHTML]().html) ||
|
||||||
[];
|
[];
|
||||||
const exportedValue = {
|
const exportedValue = {
|
||||||
on: (items[0] || "on").toString(),
|
on: (items[0] !== undefined ? items[0] : "on").toString(),
|
||||||
off: (items[1] || "off").toString(),
|
off: (items[1] !== undefined ? items[1] : "off").toString(),
|
||||||
};
|
};
|
||||||
|
|
||||||
const value = (field.value && field.value[$text]()) || "off";
|
const value = (field.value && field.value[$text]()) || "off";
|
||||||
@ -1296,6 +1296,7 @@ class CheckButton extends XFAObject {
|
|||||||
type,
|
type,
|
||||||
checked,
|
checked,
|
||||||
xfaOn: exportedValue.on,
|
xfaOn: exportedValue.on,
|
||||||
|
xfaOff: exportedValue.off,
|
||||||
"aria-label": ariaLabel(field),
|
"aria-label": ariaLabel(field),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -42,7 +42,11 @@ class XfaLayer {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
html.addEventListener("change", event => {
|
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 {
|
} else {
|
||||||
if (storedData.value !== null) {
|
if (storedData.value !== null) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user