You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Scott Coldwell (JIRA)" <ji...@apache.org> on 2016/06/22 18:55:16 UTC

[jira] [Created] (PDFBOX-3393) Javascript actions on form fields cause data to become hidden

Scott Coldwell created PDFBOX-3393:
--------------------------------------

             Summary: Javascript actions on form fields cause data to become hidden
                 Key: PDFBOX-3393
                 URL: https://issues.apache.org/jira/browse/PDFBOX-3393
             Project: PDFBox
          Issue Type: Improvement
          Components: AcroForm
    Affects Versions: 2.0.2
            Reporter: Scott Coldwell


We have run across numerous PDFs that contain javascript actions on some of the form fields.  When trying to set a value for the field, the data is there in the field, but only visible if you place the cursor in the field.  And since we flatten forms before saving them, it looks as if the data was never populated.  Some of the actions we've seen are like the following:

AFDate_KeystrokeEx("mm/dd/yyyy")
AFNumber_Keystroke(0, 0, 0, 0, "", true);

As a workaround we are remove any actions associated with a field before setting a value by doing the following:

{code}
final PDField field = form.getField(fieldName);

if (field instanceof PDTerminalField)
{
    // Need to clear any actions (typically javascript) from the fields
    ((PDTerminalField)field).setActions(null);
}
{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org