Skip to content

Commit f6fed23

Browse files
committed
Annotation - Checkboxes with the same name and export values must be in unison
- it aims to fix mozilla#14024. - this patch adds an attribute `acroformExportValue` to the HTML input in order to set the checked attribute in taking into account the exportValue for the checkboxes with the same name.
1 parent 7fb653b commit f6fed23

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/display/annotation_layer.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -976,25 +976,29 @@ class CheckboxWidgetAnnotationElement extends WidgetAnnotationElement {
976976
const element = document.createElement("input");
977977
element.disabled = data.readOnly;
978978
element.type = "checkbox";
979-
element.name = this.data.fieldName;
979+
element.name = data.fieldName;
980980
if (value) {
981981
element.setAttribute("checked", true);
982982
}
983983
element.setAttribute("id", id);
984+
element.setAttribute("acroformExportValue", data.exportValue);
984985
element.tabIndex = DEFAULT_TAB_INDEX;
985986

986987
element.addEventListener("change", function (event) {
987988
const name = event.target.name;
989+
const checked = event.target.checked;
988990
for (const checkbox of document.getElementsByName(name)) {
989991
if (checkbox !== event.target) {
990-
checkbox.checked = false;
992+
checkbox.checked =
993+
checked &&
994+
checkbox.getAttribute("acroformExportValue") === data.exportValue;
991995
storage.setValue(
992996
checkbox.parentNode.getAttribute("data-annotation-id"),
993997
{ value: false }
994998
);
995999
}
9961000
}
997-
storage.setValue(id, { value: event.target.checked });
1001+
storage.setValue(id, { value: checked });
9981002
});
9991003

10001004
if (this.enableScripting && this.hasJSActions) {

0 commit comments

Comments
 (0)