Expand my Community achievements bar.

Another HTTP Submit Question

Avatar

Former Community Member
Does any body know how to capture and handle an http response returned after a SUBMIT button transmits XML data? I'm trying to work out a method to quickly deploy short-lived forms that send their data to a lightweight HTTP listener running on the network. Everything was going swimmingly except....



If I use a SUBMIT button, I receive beautiful XML data but the return value from my listener ("Data Received", or "No Data Received", or "Failed to Write Data: notify Administrator", etc.) replaces the form in Acrobat Pro 8 and I can find no way of catching the response, and handling it in a popup window, clearing the form when necessary, etc.



On the other hand, if I use a regular button and the POST() function of FormCalc in the click event, I can easily handle the return value, clear the form when necessary, etc. but I haven't found a way to successfully iterate through the fields, read all the names and values(without knowing them in advance) and send the correct data. using XFA.Layout.pageContent I can iterate through the fields, but all I seem to be able to access is the names, and I haven't a clue how I deal with radio buttons.



Finally, I might be able to make it work with javascript, but there seems to be no equivalent to the POST() function in JavaScript.



If this makes sense, are there any suggestions?
1 Reply

Avatar

Level 6
Very interesting! I did not know about POST(). Hmmmm. You have to wonder why this would be part of the product and yet executing a web service requires usage rights.



At first I figured you could call a JavaScript function in a script object from your FormCalc button, but it turns out that you can't do that. So, here's a work-around that will allow you to process the results using JavaScript.



Create a hidden field. In the click event of your FormCalc button, put

MyHiddenField.rawValue = Post("http://whatever","whatever");



Write a javascript on the calculate event of the hidden field to handle the result.



Jared