1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-19 06:38:07 +02:00

Use the V entry as an option when no options in a choice widget

It fixes #19083.

It isn't really a fix but more a workaround (we should correctly implement the
choice widget as a mix of text input+select).
This commit is contained in:
Calixte Denizet 2024-11-21 17:27:31 +01:00
parent 07765e993e
commit b0b0de98e7
4 changed files with 22 additions and 0 deletions

View file

@ -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);

View file

@ -681,3 +681,4 @@
!issue18894.pdf
!bug1922766.pdf
!issue18956.pdf
!issue19083.pdf

BIN
test/pdfs/issue19083.pdf Executable file

Binary file not shown.

View file

@ -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"
}
]