Skip to content

Commit

Permalink
Merge pull request #19086 from calixteman/issue19083
Browse files Browse the repository at this point in the history
Use the V entry as an option when no options in a choice widget
  • Loading branch information
calixteman authored Nov 21, 2024
2 parents 445b7ec + b0b0de9 commit 5b600e8
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/core/annotation.js
Original file line number Diff line number Diff line change
Expand Up @@ -3511,6 +3511,18 @@ class ChoiceWidgetAnnotation extends WidgetAnnotation {
}
}

// It's a workaround for the issue #19083.
// Normally a choice widget is a mix of a text field and a listbox,
// So in the case where the V entry isn't an option we should just set it
// as the text field value.
if (this.data.options.length === 0 && this.data.fieldValue.length > 0) {
// If there are no options, then the field value is the only option.
this.data.options = this.data.fieldValue.map(value => ({
exportValue: value,
displayValue: value,
}));
}

// Process field flags for the display layer.
this.data.combo = this.hasFieldFlag(AnnotationFieldFlag.COMBO);
this.data.multiSelect = this.hasFieldFlag(AnnotationFieldFlag.MULTISELECT);
Expand Down
1 change: 1 addition & 0 deletions test/pdfs/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -681,3 +681,4 @@
!issue18894.pdf
!bug1922766.pdf
!issue18956.pdf
!issue19083.pdf
Binary file added test/pdfs/issue19083.pdf
Binary file not shown.
9 changes: 9 additions & 0 deletions test/test_manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -10766,5 +10766,14 @@
"rounds": 1,
"type": "eq",
"link": true
},
{
"id": "issue19083",
"file": "pdfs/issue19083.pdf",
"md5": "2e2aa6c1904c1e6a89a5a6ec95d5ce7e",
"rounds": 1,
"forms": true,
"talos": false,
"type": "eq"
}
]

0 comments on commit 5b600e8

Please sign in to comment.