Bug 436990 - Interactive PDF Forms with field validation cannot be filled due to repeating error window
Summary: Interactive PDF Forms with field validation cannot be filled due to repeating...
Status: RESOLVED FIXED
Alias: None
Product: okular
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-05-12 18:02 UTC by Lucas
Modified: 2021-06-07 17:38 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 21.04.2


Attachments
An affected PDF. Select the SID field (top right) to trigger the bug. (917.16 KB, application/pdf)
2021-05-12 18:02 UTC, Lucas
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lucas 2021-05-12 18:02:04 UTC
Created attachment 138371 [details]
An affected PDF. Select the SID field (top right) to trigger the bug.

SUMMARY
At least one example of a PDF with interactive forms is impossible to fill out with Okular. When a field with validation is selected, an error message is displayed explaining that the field is required and must have a certain format. When "Ok" is pressed, the message is immediately displayed again. When the close button on the message window is pressed, the message is immediately displayed again. Many clicks on the close button in rapid succession eventually causes the error window to not immediately be displayed again, until the field is selected again. The main window cannot be interacted with while the error window exists.

STEPS TO REPRODUCE
1. Open a PDF with affected interactive forms using Okular
2. Select an affected field (one that has validation that brings up an error window)

OBSERVED RESULT
Error window immediately displayed, and is impossible to dismiss or ignore in order to fill out the field.

EXPECTED RESULT
Field can be edited, or a less obtrusive error is shown that does not interfere with editing the field.


SOFTWARE/OS VERSIONS
Windows: 10 Pro Version	10.0.19042 Build 19042
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 5.67.0
Qt Version: 5.14.1

Okular version: 1.10.70 (installed via Chocolatey)

ADDITIONAL INFORMATION
Comment 1 Laura David Hurka 2021-05-12 23:23:48 UTC
Would a good fix be that the error message appears as hovering text field, or as a red background, instead of a blocking dialog?

There are websites where form fields are shown as “invalid” instead of “incomplete” when you haven’t yet typed anything. I guess the same happens here.
Comment 2 Albert Astals Cid 2021-05-13 20:35:38 UTC
It's not errors, it's messagebox popped up by the Javascript of the document, could very well be anything, so no they can't appear anyway else.

I have not checked the code at all, but my guess the problem here is, that the file does:

 If the field has an won focus -> show messagebox saying what the field contents has to be

But that makes it lose the focus to the messagebox and win it again, so 

 If the field has an won focus -> show messagebox saying what the field contents has to be


etc. etc.

Would need time to check that is indeed the problem and make it realize that if it's winning the focus and had it and was lost because a mesagebox was shown, there's no need to show the messagebox again.

And also check what Adobe Reader does with the file, because it's super easy to infinite loop firefox too
Comment 3 Albert Astals Cid 2021-05-24 22:30:02 UTC
Git commit 37aacc7f8bba67e0ec6b4854d901fe9dab4a8efd by Albert Astals Cid.
Committed on 24/05/2021 at 22:26.
Pushed by aacid into branch 'okular_focus_actions'.

FormLineEdit: Don't run focusin action when gaining focus because of window management

Adobe Reader doesn't do it, and with reason, because otherwise we end up
with:
 * Run focus in script
 * script shows alert()
 * field loses focus and gains it again once the alert() is closed
 * infinite loop

M  +6    -2    part/formwidgets.cpp

https://invent.kde.org/graphics/okular/commit/37aacc7f8bba67e0ec6b4854d901fe9dab4a8efd
Comment 4 Albert Astals Cid 2021-05-24 22:31:56 UTC
I made a mistake and push it to the wrong branch, fix has still not landed
Comment 5 Albert Astals Cid 2021-06-04 21:44:10 UTC
Git commit e457ceb73146790c5d4a9914182433ab4002815e by Albert Astals Cid.
Committed on 04/06/2021 at 21:17.
Pushed by aacid into branch 'release/21.04'.

FormLineEdit: Don't run focusin action when gaining focus because of window management

Adobe Reader doesn't do it, and with reason, because otherwise we end up
with:
 * Run focus in script
 * script shows alert()
 * field loses focus and gains it again once the alert() is closed
 * infinite loop

M  +6    -2    part/formwidgets.cpp

https://invent.kde.org/graphics/okular/commit/e457ceb73146790c5d4a9914182433ab4002815e