Skip to content

Commit

Permalink
Include the name for interactive form elements
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
roccobeno authored and timvandermeij committed Apr 27, 2020
1 parent d469b42 commit 371e699
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/display/annotation_layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 371e699

Please sign in to comment.