Skip to main content
Oct 6, 2016 9:13 AM UTC
Question

Ajax call on acrobat form by javascript

Is it possible to make an ajax call on acrobat form by javascript so that I can get data from server and fill the dropdown list item on runtime?

This topic is closed to new replies. Start a new post to keep the conversation going.

7 replies

Oct 7, 2016 2:49 AM UTC

Thanks for response!

What I want to do is use acrobat e-form to replace traditional web form in my web application, so I need to make a interactive e-form to deal with user selection.

For example, one of the use case, I need to make an ajax call on acrobat form by javascript so that I can get data from server and fill the dropdown list item on runtime

Is that acrobat e-from possible to act as traditional web form? Or LiveCycle server is the solution?

Please advice!

Translate
Karl Heinz  Kremer
Community Expert
Community Expert
Oct 7, 2016 2:20 PM UTC

You can submit form data via FDF or XFDF (or even HTML) and then respond back to the form with FDF or XFDF (in this case, HTML is not an option, that's why I stick with FDF/XFDF both ways). The only drawback is that you can only send and receive information in form fields, so you may need to create some hidden fields that you use just for this type of communication.

Take a look at this for more information: Acrobat DC SDK Documentation - Doc.submitForm()

Translate
Legend
Oct 7, 2016 4:34 PM UTC

There is much to consider that you may not be aware of. Such a form would need the Mac or Windows version of Acrobat Reader. Can you force all your users to have this configuration? Are you sure nobody will ever want to use it from their tablet or phone? Frankly, I can see no reason whatever to move from working HTML forms to PDF forms. Even Adobe are moving away from it.

Translate
try67
Community Expert
Community Expert
Oct 6, 2016 9:27 AM UTC

No, you can't use Ajax in a PDF, but you can do an HTTP request or a call to a SOAP service. It's all documented under the Net object in the Acrobat JavaScript API Reference.

Translate
Oct 6, 2016 11:07 AM UTC

Thank you so much try67!

I follow the Acrobat JavaScript API Reference to create the following script.js and put it into the folder level folder:

function ajax(cURL) {

    var params =

    {

            cVerb: "GET",

            cURL: cURL,

            oHandler:

            {

                    response: function(msg, uri, e,h){

                            var stream = msg;

                            var string = "";

                            string = SOAP.stringFromStream( stream );

                            app.alert( string );

                    }

            }

    };

    Net.HTTP.request(params);

}

then I create a button on the pdf form and call a javascript: ajax('http://localhost/app/ajaxCall');

But it return this error: NotAllowedError: Security setting prevent access to this property or method.

Any suggestions?

Translate
try67
Community Expert
Community Expert
Oct 6, 2016 12:08 PM UTC

Using this method requires "forms rights", which usually means a special right applied with a LiveCycle server application...

Translate