Bug 474889 - Form field misuse leads to 'NaN' which won't disappear
Summary: Form field misuse leads to 'NaN' which won't disappear
Status: RESOLVED FIXED
Alias: None
Product: okular
Classification: Applications
Component: PDF backend (show other bugs)
Version: 23.08.1
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-09-26 08:42 UTC by Oliver Sander
Modified: 2024-06-25 13:53 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 24.08.0
Sentry Crash Report:


Attachments
The problematic document (59.18 KB, application/pdf)
2023-09-26 08:42 UTC, Oliver Sander
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Oliver Sander 2023-09-26 08:42:42 UTC
Created attachment 161880 [details]
The problematic document

I have a pdf document with a form field that should (I guess) only accept numbers.  By deliberate entering a non-digit I can make it show NaN.  Afterwards, it is not possible to remove this NaN again.

STEPS TO REPRODUCE
1. Open the attached document; click on 'show forms'
2. Click on the top left square (below "70 Liter")
3. Enter the letter X
4. Click outside of that square --> the X changes to NaN
5. Click into the square again --> the NaN changes back to X
6. Replace the X by a 2
7. Click on "hide forms"

OBSERVED RESULT

Instead of the number "2" the "NaN" is shown again.

EXPECTED RESULT

I am not quite sure what to expect.  Should I be prevented from entering non-digits in the first place?  At the very least I would expect to see a "2" at the end of the seven steps, not NaN.

SOFTWARE/OS VERSIONS
Betriebssystem: Debian GNU/Linux 12
KDE-Plasma-Version: 5.27.5
KDE-Frameworks-Version: 5.103.0
Qt-Version: 5.15.8
Comment 1 Nicolas Fella 2023-12-11 17:08:47 UTC
The form field uses the AFNumber_Keystroke script, which we don't implement (see https://invent.kde.org/graphics/okular/-/blob/master/core/script/builtin.js#L152)

https://invent.kde.org/graphics/okular/-/merge_requests/519 covers this

That means the expected behavior would be to reject any input that is not a digit or separator
Comment 2 Nicolas Fella 2024-06-25 13:51:47 UTC
https://invent.kde.org/graphics/okular/-/merge_requests/988 implements AFNumber_Keystroke, so it's no longer possible to enter non-numeric characters