mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 10:08:06 +02:00
[JS] Handle correctly choice widgets where the display and the export values are different (issue #15815)
This commit is contained in:
parent
64786b4c93
commit
0c1ec946aa
8 changed files with 155 additions and 30 deletions
|
@ -1978,7 +1978,15 @@ class WidgetAnnotation extends Annotation {
|
|||
|
||||
assert(typeof value === "string", "Expected `value` to be a string.");
|
||||
|
||||
value = value.trim();
|
||||
if (!this.data.combo) {
|
||||
value = value.trim();
|
||||
} else {
|
||||
// The value is supposed to be one of the exportValue.
|
||||
const option =
|
||||
this.data.options.find(({ exportValue }) => value === exportValue) ||
|
||||
this.data.options[0];
|
||||
value = (option && option.displayValue) || "";
|
||||
}
|
||||
|
||||
if (value === "") {
|
||||
// the field is empty: nothing to render
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue