It’s not a tutorial so much as it is a quick tour, but if you’re curious about LiveCycle, Designer, Workbench and how they interact, have a look.
Working for Adobe, I have access to Adobe software. Acrobat is a tool I don’t think I would have considered buying before starting with Adobe, but after using it for the last two years, I can say it’s right up there with Microsoft Office as one of the things I’d have to have on a new computer.
I was reminded of this just recently, when I was filling out the Tarion 30 day warranty form for my new house.
I received a paper copy of this form as part of the huge stack of documents I got when the house sale closed, but after compiling a list of ~30 items, I just didn’t feel like writing it all out. That’s where Acrobat comes in.
Fillable forms come in two flavours: XFA and Acroform. Acroform forms are forms where you’ve placed the input fields on the form using Acrobat itself; XFA forms are forms created using the Form Designer tool.
I found the forms online, but they’re not fillable. This is pretty common – form authors create forms using something like Illustrator or InDesign, and then create a PDF from that and just post it online, rather than taking the extra step of importing that into Form Designer and adding fields.
But Acrobat has a feature that’s designed for this specific problem: The Typewriter Tool.
I loaded up the Tarion form, got out my handy typewriter, and filled out the form. Printed it, signed it, and faxed it off.
The nice thing about doing it this way is that as I was filling out the form, quite a few times I had to go back and edit something; if I was filling it out on paper, that would have been impossible. I could have filled out a draft on paper and then copied it to the real form, but that’s just more work.
What would the next best thing have been? Loading a bitmap of the form into PhotoShop and filling it out there, I guess – doable, but not nearly as easy.
I posted about what the data looks like when you submit a form using an HTTP Submit Button, but there are other ways of submitting forms.
I’ve created a Submit Comparison PDF that has a few fields on it, and buttons for the four different types of data submission that Acrobat supports.
These are: XDP, PDF, XML, and URL-encoded.
URL-encoded is what the HTTP Submit Button does; to use one of the other formats, drop a Button onto your form, set the Control Type to Submit, and then you can use the Submit tab on the Object Inspector to control how the data is submitted.
Submitting in XDP format gives you XML data that includes an xfa:data model, as well as an execEvent node that identifies which button the user pushed to submit the form. This provides the most data.
Submitting XML gives you the same data that you’d get if you emailed the filled out form data from Reader – it’s an XML packet with a chunk of friendly human-readable text that describes how to submit the data. The form data you get is the same as what you get with the XDP format, but without the xfa wrappers.
Try out the PDF file I linked above – the Submit button posts to my dump.php script so you can see what actually got submitted.
There are a number of different ways to submit a form, and which one is right depends on context. When your form is part of a workflow created with Adobe’s Workflow Server, you need to submit using the LiveCycle Workflow fields:
These ensure that the user has the controls they need for the state they’re at in the workflow.
Outside of Workflow, you can still create forms that integrate with server side processes. Form Designer and Reader support two methods for submitting data: submitting form data as application/x-www-form-urlencoded using HTTP POST, and SOAP. The former is what I’m talking about in this post.
When you create an HTML form, you add some HTML fields, and a URL to POST to as the <form> tag’s action. For example:
<form method="post" action="http://stevex.net/dump.php"> <label>TextField1 <input type="text" name="TextField1" /> </label>
I’ve created a simple PHP script that dumps out what you submit to it parsed (so you can see what variables PHP found in the submitted data) as well as the raw POST body. The script is here. Typing "hello" into the text field and submitting this form shows that the following data was sent to the action URL:
Simple enough. It gets more complicated when there are more fields or special characters need escaping; the exact details of how that works are spelled out in the HTML 4.01 spec section 17.13.4 which covers application/x-www-form-urlencoded encoding, the MIME type that form data is submitted with.
So that’s how HTML submit works. What happens when you create a form with Form Designer and want to submit it using HTTP?
Here’s how to create a form equivalent to that little HTML form described above.
After step 3, you’ll have a Submit button on the form, with a wee yellow marker. Hover the mouse over the marker and you’ll see this message:
This handy reminder just lets you know that you need to click on the Submit button and in the Object Inspector, set the URL that the form will be posted to to something. (I don’t know about you but when creating HTML forms I’ve forgotten to enter the action URL more than once).
Designer’s preview is actually an embedded Internet Exporer, with a temporary PDF rendering of your form loaded into it. This means clicking the Submit button in the preview window will submit your form and you can see the results of the submit right in Designer.
Submitting from Acrobat is a bit more involved because Acrobat can’t display the HTML response directoy, but what happens is actually pretty cool. The HTTP submit happens, and the resulting HTML is captured by Acrobat and converted into a PDF, so you see the dump response page, but you see it in Acrobat as a PDF.
There are some limitations that come with submitting form data as HTTP. Because HTML forms aren’t hierarchial, any hierarchy in your own form is lost – for example, nesting fields within subforms will cause them to not appear in the submitted data. These limitations are mentioned in Designer’s documentation.
I’ve attached my sample HTTP Submit PDF form
so you can have a look at a few different field types and how they look in the submitted data.
So that covers HTTP submit. You can do a lot more with SOAP than just submit data, but that’s another story.
I’m going to occasionally talk about Adobe’s Form Designer in this blog, because that’s what I work on.
Designer comes with Acrobat Professional, although it’s not installed by default. If you have Acrobat installed, and you don’t have Designer, go dig out your Acrobat disc and install it. I’ll wait here.
There are a significant number of blogs in the world (I’d guess, at least 25% of all blogs created) whose only post is some equivalent of a “Hello, World” post.
So here’s mine. Hi!
Difference is, of course, that I’ll be back.
(But that’s what they all say isn’t it? Stay tuned…)