From 371e699905e41ec830b7b5c47975f50056c87160 Mon Sep 17 00:00:00 2001 From: roccobeno <62256813+roccobeno@users.noreply.github.com> Date: Mon, 27 Apr 2020 16:51:18 +0200 Subject: [PATCH] Include the name for interactive form elements We already rendered the name for radio buttons, but it was missing for all other interactive form elements. This commit adds that so that values entered in form elements can be read based on the element name. --- src/display/annotation_layer.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/display/annotation_layer.js b/src/display/annotation_layer.js index e16f3c3ae41c2..cee8ee77d690b 100644 --- a/src/display/annotation_layer.js +++ b/src/display/annotation_layer.js @@ -456,6 +456,7 @@ class TextWidgetAnnotationElement extends WidgetAnnotationElement { } element.disabled = this.data.readOnly; + element.name = this.data.fieldName; if (this.data.maxLen !== null) { element.maxLength = this.data.maxLen; @@ -545,6 +546,7 @@ class CheckboxWidgetAnnotationElement extends WidgetAnnotationElement { const element = document.createElement("input"); element.disabled = this.data.readOnly; element.type = "checkbox"; + element.name = this.data.fieldName; if (this.data.fieldValue && this.data.fieldValue !== "Off") { element.setAttribute("checked", true); } @@ -620,6 +622,7 @@ class ChoiceWidgetAnnotationElement extends WidgetAnnotationElement { const selectElement = document.createElement("select"); selectElement.disabled = this.data.readOnly; + selectElement.name = this.data.fieldName; if (!this.data.combo) { // List boxes have a size and (optionally) multiple selection.