Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
8

How does this.submitForm work?

Explorer ,
Mar 19, 2024 Mar 19, 2024

I am submitting to an endpoint and it returns a simple FDF file

                %FDF-1.2
                1 0 obj
                <<
                    /FDF
                    <<
                        /Fields
                        [
                            << /T(Status) /V(OK) >>
                        ]
                    >>
                >>
                endobj
                trailer
                << /Root 1 0 R >>
                %%EOF

How are the fields going to be read? Are the values of the fields going to be populated in some way in the currently opened PDF file?

TOPICS
JavaScript , PDF , PDF forms
1.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
1 ACCEPTED SOLUTION
Community Expert ,
Mar 21, 2024 Mar 21, 2024

As Bernd states, there is not field named "Status" on the form. There is one named "field_1". But that's not referenced in the FDF file.  So the FDF file will do nothing. 

 

An easy test for any FDF file is to save it to a local file and then load it manually using the "Import" menu item in "Prepare Form".  An easy way to verify the format of the FDF is to export data form the form to an FDF usingthe "Export" menu item. Then you can compare the FDF file your loading with one generated by Acrobat, from the specific PDF.

 

  

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

View solution in original post

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 20, 2024 Mar 20, 2024

The PDF Reference explains the FDF format.

https://pdfa.org/resource/pdf-specification-archive/

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 20, 2024 Mar 20, 2024

The returned FDF file is applied to the PDF that performed the submit action. 

But if for example, the current PDF did not contain a text field named "Status", then nothing would happen. 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 20, 2024 Mar 20, 2024

Thanks for your answer, however I'm having some difficulties getting the response to be shown on the PDF.

I have attached a PDF with a text field named "Status". I call `this.submitForm` within this PDF and the server responds with the FDF file I sent above. But after the submission, I don't see any value in the field. Any ideas?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 21, 2024 Mar 21, 2024

The PDF file has no field with the name "Status".

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 21, 2024 Mar 21, 2024

As Bernd states, there is not field named "Status" on the form. There is one named "field_1". But that's not referenced in the FDF file.  So the FDF file will do nothing. 

 

An easy test for any FDF file is to save it to a local file and then load it manually using the "Import" menu item in "Prepare Form".  An easy way to verify the format of the FDF is to export data form the form to an FDF usingthe "Export" menu item. Then you can compare the FDF file your loading with one generated by Acrobat, from the specific PDF.

 

  

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 24, 2024 Mar 24, 2024
LATEST

Thank you, I figured it out and managed to populate the field with the returned FDF.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines