Bug 307304 - Javascript in forms not working correctly
Summary: Javascript in forms not working correctly
Status: CONFIRMED
Alias: None
Product: okular
Classification: Applications
Component: PDF backend (show other bugs)
Version: unspecified
Platform: openSUSE Linux
: NOR wishlist
Target Milestone: ---
Assignee: Andre Heinecke
URL:
Keywords:
Depends on: okular-js
Blocks:
  Show dependency treegraph
 
Reported: 2012-09-24 06:23 UTC by p
Modified: 2020-08-18 22:07 UTC (History)
7 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
test document (995.81 KB, application/pdf)
2018-04-13 14:22 UTC, p
Details

Note You need to log in before you can comment on or make changes to this bug.
Description p 2012-09-24 06:23:41 UTC
Take this pdf http://www.debeka.de/service/formulare/leistungsantrag_krankenversicherung/lea_082011_bf_speicherbar_pdf.pdf and enter some values in the table at the bottom. In the field "Summe Euro-Beträge" you should see the sum of values. But that field stays empty at all times. This works on the adobe reader.

Reproducible: Always
Comment 1 Bernd Oliver Sünderhauf 2012-12-03 11:14:16 UTC
Confirming and fixing meta-bug tracking.
Comment 2 Michael Weghorn 2017-07-20 11:40:23 UTC
The URL in the bug report no longer points to a valid PDF file.
Can the respective PDF file possibly be attached to the bug report?
Without the file, there is no way to reproduce the bug and thus to try fixing
it...
Comment 3 Albert Astals Cid 2017-07-28 20:32:28 UTC
I sadly did not keep a copy of this file on my HD, so i'll mark this as needs info and see if the reported can provide the file, if not we'll have to close it since it can be known what had to be fixed.
Comment 4 p 2018-04-13 14:22:26 UTC
Created attachment 112004 [details]
test document
Comment 5 p 2018-04-13 14:23:27 UTC
Test document added as attachment. It still shows the same issue. Adobe Reader works fine, okular doesn't work.
Comment 6 Albert Astals Cid 2018-04-16 22:42:06 UTC
Andre, seems the file should work since it uses the SUM() thing you implemented but it doesn't seem to be working, would you be able to give it a quick look?
Comment 7 Andre Heinecke 2018-04-17 07:57:12 UTC
The problem here is that the SUM fields start readOnly / invisible. The calculation works and if you set the fields to visible by hand they are updated correctly.


In the PDF itself I find such scriptlets:
{
var summe = this.getField("Summe Spalte 1").value;

if(summe <= "0")
{
   this.getField("Summe Spalte 1").display = display.hidden;
} 
else
    this.getField("Summe Spalte 1").display = display.visible;
}

Currently there is no support for the display property and display object. These scripts are also not executed. Poppler currently does not parse the scriplets. pdfinfo -js does not show them.

Looking at them in Adobe shows that the visibility scriptlets should be executed when a field is deactivated. I guess that means something like "Editing finished". The trigger has the Key "Bl".

So:
1. Parse "Bl" Triggered actions in poppler.
2. Execute them in Okular.
3. Add basic support for the display object / property in Okulars JavaScript.


I'll look into it.
Comment 8 Albert Astals Cid 2018-04-17 18:44:08 UTC
Please add okular-devel to the CC if you assign a bug to yourself.