Displaying forms in an HTML page

When you embed an XFDL form in an HTML page, you are essentially declaring that a portion of the web page is controlled by a program other than the browser, such as the Viewer. As a result, this portion of the page operates differently than the HTML page in which it resides.

For example, if a user is filling out a form on a Web page but needs more information to complete it, he or she might click a link on the HTML page and go to a new page. Normally when users perform this action, any data that they have entered into the form is lost. However, with an XFDL form, the form can be detached from the first Web page and provided for viewing in a second Web page.

When a form is detached from one Web page and reattached to another, it maintains all of the user's data. Unlike the first Web page, any successive Web pages that need to display the same form do not need to explicitly embed the form. If you want them to display the same form and retain user data, they must contain objects that share the same detach_id.

Successive pages do not have to display the same form. A second Web page can display a different form if it contains a different object. You can even redirect users to a different Web page if they are taking too long to complete a form and the detached form has timed out. Objects that contain a refresh_URL ensure that users can be directed to another Web page if they need help or to a new form if they abandon completion of the old one.

Once the Viewer is embedded in an HTML Web page, you can treat it like any other HTML object. For example, you can use JavaScriptâ„¢, other portlets, or servlets to generate dynamic content within the object or form. You can also generate new XML instances for your form.