Embed the formAdded by IBM on May 5, 2011 | Version 1 (Original)
To embed the form:
- Create a new HTML file and give it a meaningful name, such as tutorial.html.
Note that the order is important. First LF_XFDL.js
, then LF_FormNodeP.js
, and finally LF_ViewerScript.js
folder of IBM® Forms Viewer.
- Next, embed the form. This is done within HTML script tags:
<script language="XFDL" id="XFDLData" type="application/vnd.xfdl; wrapped=comment">
<?xml version="1.0" encoding="UTF-8"?>
<!-- rest of form not shown for brevity -->
The entire form is presented later, in The complete application
var objectID = "Main";
- Create the body element of the page. For now, the body will have only the div that contains the Viewer and the script that embeds the Viewer. You will add additional elements later.
"viewer", // id of the HTML div element
objectID, // id to assign to the object element
500, 400, // width and height of the Viewer
"XFDLID", "XFDLData", // name-value pair for XFDL param
"detach_id", "2507088000" // name-value pair for detach_id param
- Save the file, then open it in either Firefox or Internet Explorer.
You should see something like this:
When you have the form displayed in your browser, change one or more of the fields. When you change a value, the Age field is not updated, but this is the expected behavior for this form. As mentioned previously, it was originally intended for demonstrating server-side processing of completed forms. Normally, this form would be processed on the server using either the C or Java™ API. In this case though, you want to make the form interactive without redesigning it.
The next step is to register the form with the API.
Parent topic: A single HTML file scenario