Bug 418445 - PDF Form with JavaScript logic cannot be populated properly
Summary: PDF Form with JavaScript logic cannot be populated properly
Status: RESOLVED FIXED
Alias: None
Product: okular
Classification: Applications
Component: PDF backend (show other bugs)
Version: 1.9.2
Platform: Other Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-03-03 21:13 UTC by andreaswuest
Modified: 2021-01-11 23:03 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Form to be populated. (616.02 KB, application/pdf)
2020-03-03 21:13 UTC, andreaswuest
Details

Note You need to log in before you can comment on or make changes to this bug.
Description andreaswuest 2020-03-03 21:13:33 UTC
Created attachment 126580 [details]
Form to be populated.

Hi,

the norwegian form for refund of of withholding tax cannot be populated with okular. The Problem seems to be the contained Javascript logic. The user can enter the Gross amount in NOK of the stock to be refunded. The withholding tax of 25% should be cacualted by the form, same with the refund claim of 10%.
for some reason, the calculation fo the sum seems to work.
I do not have to mention that it works with the acrobat reader.
another thing i notice is, that popuating the form fields is supper slow for some reason - when you press a key you can visibly notice the latency until the key shows up in the form.

The form can be found here: https://www.skatteetaten.no/globalassets/skjema/alltid/1-refusjonsskjema-skatteavtale-person (see attachment)


STEPS TO REPRODUCE
1. open pdf file
2. goto section 5
3. enter amounts in the column "Gross amount in NOK"


OBSERVED RESULT
The dependent columns remain unchanged with value 0.0 (withholding tax and refund claim)

EXPECTED RESULT
The dependent columns should be automatically calulated (withholding tax and refund claim)


SOFTWARE/OS VERSIONS
Windows: 10
KDE Plasma Version: 
KDE Frameworks Version: 5.67
Qt Version: 5.14.0
Poppler Version 0.85.0

ADDITIONAL INFORMATION
Its the official Okular Version for Windows from the MS Store.
Comment 1 Albert Astals Cid 2020-03-08 15:44:34 UTC
It's a bit annoying and the PDF is using hideen "combo boxes" forms for the 10%, 25% and we don't have "get value of combo box" implemented yet, so that's why it fails
Comment 2 Albert Astals Cid 2020-03-28 23:46:36 UTC
Git commit 5035f90dd9c0290d1f829964029c86b9b1deadec by Albert Astals Cid.
Committed on 28/03/2020 at 23:12.
Pushed by aacid into branch 'master'.

Fix forms sometimes showing an old value

If from processFormatAction we call setAppearanceText,
we need to call setAppearanceText from outside too, otherwise when the
formatting action doesn't create a different text we still show the old
old value

M  +1    -0    core/document.cpp

https://invent.kde.org/kde/okular/commit/5035f90dd9c0290d1f829964029c86b9b1deadec
Comment 3 Albert Astals Cid 2020-03-28 23:46:36 UTC
Git commit d3b43b0b1e46f66d8b6e2a1d8d2d7ef3875136d0 by Albert Astals Cid.
Committed on 28/03/2020 at 23:12.
Pushed by aacid into branch 'master'.

Implement AFMakeNumber

Also make stringToNumber be stubborn when converting strings to numbers

M  +10   -0    core/script/builtin.js
M  +11   -10   core/script/kjs_util.cpp

https://invent.kde.org/kde/okular/commit/d3b43b0b1e46f66d8b6e2a1d8d2d7ef3875136d0
Comment 4 andreaswuest 2021-01-09 20:32:06 UTC
Hi, 

what is the current state of the issue - i have seen that you have fixed the problem described. Tested with version 1.11.1 KDF Frameworks 5.74.0 QT 5.15.1
and Poppler 0.89.0 (version from the windows store).

However, okular has some more javascript issues with the attached document. Do you want me to add the problems here, or do you you want me to describe the problems in another ticket (in this case i think we can close this ticket).

Cheers,
Andreas
Comment 5 Albert Astals Cid 2021-01-09 21:35:36 UTC
Yes, i know there's still things to fix, have it in my infinite todo, this is why this is not marked as resolved.

If you have time it's always better to have a more detailed description of what's missing so i would appreciate if you can write a new issue describing what's missing (in case we magically get more people to look at bugs than me) and close this one.
Comment 6 andreaswuest 2021-01-11 20:01:28 UTC
i have created a new ticket (431461) for the other problem, so i guess you can close this one.