You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Attach (recommended) or Link to PDF file here: _pdf4.pdf
Configuration:
Web browser and its version: Firefox 115
Operating system and its version: Windows 10
PDF.js version: 3.7.107
Is a browser extension: no
Implementing a web application with pdfjs-dist package and enabling forms, if a textfield has a default value it always will render with that value even if there are a different value in storage.
The expected behavior is for textfields hold the user's value.
I think the issue is probably caused by this code:
constelementData={userValue: textContent,formattedValue: fieldFormattedValues,lastCommittedValue: null,commitKey: 1,};if(this.data.multiLine){element=document.createElement("textarea");element.textContent=fieldFormattedValues??textContent;// <-- hereif(this.data.doNotScroll){element.style.overflowY="hidden";}}else{element=document.createElement("input");element.type="text";element.setAttribute("value",fieldFormattedValues??textContent);// <-- also here...if(this.data.doNotScroll){element.style.overflowX="hidden";}}
textContent has the stored user's value and fieldFormattedValues look to has the default value, you can see that fieldFormattedValues has more precedence than textContent, maybe switching the precedence could fix it.
The text was updated successfully, but these errors were encountered:
I also noticed when blur event is dispatched textfield restores to default because fieldFormattedValues has the default value, so i think both problems could be fixed by adding this line:
// if `textContent` has user's value `fieldFormattedValues` isn't neededfieldFormattedValues=textContent ? null : fieldFormattedValuesconstelementData={userValue: textContent,formattedValue: fieldFormattedValues,lastCommittedValue: null,commitKey: 1};
Implementing a web application with pdfjs-dist package and enabling forms, if a textfield has a default value it always will render with that value even if there are a different value in storage.
Attach (recommended) or Link to PDF file here: _pdf4.pdf
Configuration:
Implementing a web application with pdfjs-dist package and enabling forms, if a textfield has a default value it always will render with that value even if there are a different value in storage.
The expected behavior is for textfields hold the user's value.
I think the issue is probably caused by this code:
pdf.js/src/display/annotation_layer.js
Line 1181 in abb24f8
textContent
has the stored user's value andfieldFormattedValues
look to has the default value, you can see thatfieldFormattedValues
has more precedence thantextContent
, maybe switching the precedence could fix it.The text was updated successfully, but these errors were encountered: