This Quick Start describes how to use the Forms service to create a process to use XDP data submitted from a rendered PDF form. The XDP data can be saved to a database, sent to another service for processing, or manipulated and saved for later processing. For more information about the Forms service, see LiveCycle ES2 Services.
When using the Forms service, data is submitted as XDP data. The resulting data is converted to XML data (without the XDP data). In the form design, the type of data submitted can be configured. (See LiveCycle Designer ES2 Help.) For example, an organization has a process that uses a common PDF form that is rendered to applicants to submit loan requests in North America. Separate groups in the organization handle the loan requests based on the country as follows:
In a web browser, applicants fill a PDF form that is rendered by the Forms service. The country that an applicant resides in is determined by the Country field. Users select the country in which they reside using a drop-down list. The drop-down list contains the values Canada and United States.
An application, named handleSubmissionApp, implements the service for the organization. When a user clicks the Submit button in the PDF form, XDP data is sent to a Java servlet. The servlet invokes the handleSubmissionApp service. The service uses the Forms to process the XDP data and in a separate step and saves it to an XML file. The XDP data from an applicant in the United States is saved to the network location \\GroupA_US\loan.xml. The XDP data from an applicant in Canada is saved to the network location \\GROUP_B_CAN\loan.xml. To keep the loan request data files unique, a unique numeric string is appended to end of the filename. For example, loan1.xml is created if the loan.xml file exists at the network location.
The handleSubmissionApp application includes a process, named handleFormSubmission, that includes the following items:
The process diagram for the handleFormSubmission process looks like the following illustration:
Note:Conditional routes appear as dotted lines in the process diagrams.
The following text shows relevant parts of the XDP data for understanding this Quick Start. The data is stored in the <xfa:datasets> element and each element in the XML tree can be accessed in the process. In the example that follows, the applicant resides in the United States:
<?xml version="1.0" encoding="UTF-8"?> <?xfa generator="XFA2_4" APIVersion="3.0.8262.0"?> <xdp:xdp xmlns:xdp="http://ns.adobe.com/xdp/" timeStamp="2009-11-27T19:16:38Z" uuid="1fe71528-34a5-43df-8ad1-7f08126b3698"> ... <xfa:datasets xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/"> <xfa:data> <LoanApp> <Name>Akira Tanaka</Name> <LoanAmount>100000</LoanAmount> <PhoneOrEmail>firstname.lastname@example.org</PhoneOrEmail> <Country>United States</Country> <ApprovalStatus>PENDING APPROVAL</ApprovalStatus> </LoanApp> ... <xfa:data> ... </xdp:xdp>
For the processFormSubmission operation, the following properties are configured to retrieve information from the submitted data:
There are routes from processFormSubmission operation to the Write Document and Write Document2 operation. Using an XPath expression, a condition is added to the route to the Write Document operation. The XPath expression evaluates the value in the Country field from the
<xfa:data> element in the data. The following condition executes the Write Document operation when the Country field is set to United States:
Note: XPath expressions allow you access data in the XML data structure. (See Creating XPath expressions in Creating Processes Using LiveCycle Workbench ES2.)
CONTEXT_TYPEand Value is
application/vnd.adobe.xdp+xmlis added. The entry specifies the type of file that is submitted.
For the Write Document operation, the following properties are configured to save XML data to a network location:
\\GroupA_US\loan.xmlis typed. The value specifies the location and name of the PDF file.
For the Write Document2 operation, the following properties are configured to save the XML data to a network location:
\\GroupB_CAN\loan.xmlis typed. The value specifies the location and name of the PDF document.
The form used to submit data must be rendered using Forms service. For example, use the Render PDF Form operation to render a PDF form for submission. You cannot use a PDF form created in Acrobat to submit a form to the Forms service. For a web-based system, consider using a Java servlet. (See Creating Web Applications that Renders Forms in Programming with LiveCycle ES2.) The Java servlet can handle the rendering and the submission of the PDF form for users that use the service from a web browser.
This Quick start does not describe how to pass the XDP data from a Java servlet to invoke the service. (See Passing data to LiveCycle ES2 services using the Java API in Programming with LiveCycle ES2.)
Any references to company names, company logos and user names in sample material or sample forms included in this documentation and/or software are for demonstration purposes only and are not intended to refer to any actual organization or persons.