mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Merge pull request #17541 from calixteman/issue17540
Use the original value of a field when propagating event (fixes #17540)
This commit is contained in:
commit
f24246150e
6 changed files with 81 additions and 8 deletions
|
@ -220,10 +220,6 @@ class AForm {
|
|||
bCurrencyPrepend
|
||||
) {
|
||||
const event = globalThis.event;
|
||||
if (!event.value) {
|
||||
return;
|
||||
}
|
||||
|
||||
let value = this.AFMakeNumber(event.value);
|
||||
if (value === null) {
|
||||
event.value = "";
|
||||
|
|
|
@ -335,7 +335,7 @@ class EventDispatcher {
|
|||
|
||||
event.value = null;
|
||||
const target = this._objects[targetId];
|
||||
let savedValue = target.obj.value;
|
||||
let savedValue = target.obj._getValue();
|
||||
this.runActions(source, target, event, "Calculate");
|
||||
if (!event.rc) {
|
||||
continue;
|
||||
|
@ -344,18 +344,23 @@ class EventDispatcher {
|
|||
if (event.value !== null) {
|
||||
// A new value has been calculated so set it.
|
||||
target.obj.value = event.value;
|
||||
} else {
|
||||
event.value = target.obj._getValue();
|
||||
}
|
||||
|
||||
event.value = target.obj.value;
|
||||
this.runActions(target, target, event, "Validate");
|
||||
if (!event.rc) {
|
||||
if (target.obj.value !== savedValue) {
|
||||
if (target.obj._getValue() !== savedValue) {
|
||||
target.wrapped.value = savedValue;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
savedValue = event.value = target.obj.value;
|
||||
if (event.value === null) {
|
||||
event.value = target.obj._getValue();
|
||||
}
|
||||
|
||||
savedValue = target.obj._getValue();
|
||||
let formattedValue = null;
|
||||
if (this.runActions(target, target, event, "Format")) {
|
||||
formattedValue = event.value?.toString?.();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue