PreviousDeveloping Internet Applications Creating New ApplicationsNext

Chapter 3: Forms and HTML

This chapter explains the basic concepts of HTML forms. It also describes the different output options for Form Designer.

3.1 Overview

Forms are the user-interface to your application. The simplest form has some controls (like entry fields, radio buttons and check boxes), and a pushbutton to submit the form. When the form is submitted, it makes a request to the Web server to start a server-side program, bundles up the data entered onto the form, and sends it to the server.

You don't need to know anything about GUI or event-driven programming to use simple forms like this. Form Designer enables you to paint the form, so you don't need to know anything but COBOL.

You can also design more complex forms, where the controls can interact with each other while the end-user is entering data. For example, you might disable certain fields unless a particular radio button is selected. For this type of form you need to learn some JavaScript, which is a scripting language for HTML Web pages. Form Designer helps you here too, through the Script Assistant which makes it easy to set up event handlers and connect them to events on your form. Setting up event handlers is covered in the chapter Client-side Programming.

3.2 Controls and Data

Each control on a form has a name and a value. When the end-user submits the form, the information on the form is sent to the server-side program as a set of name/value pairs. Extensions to COBOL syntax enable you to associate the names of the controls on the form directly with COBOL data items in your server-side program. When the data in the form is posted to the server-side program, the data items are set to the values of the controls on the form. The way you do this is covered in the chapter Server-side Programming.

COBOL and Form Designer currently provide simple to use support for the following types of controls:

These are the basic controls available on HTML forms. Form painting is covered in the chapter Creating New Applications

3.3 HTML, Java and ActiveX

In addition to standard HTML form controls, you can also add ActiveX controls and Java applets to your HTML pages. ActiveX controls and Java applets are alternative methods for adding greater interactivity to a page. The table below summarizes the main differences between ActiveX and Java applets. These technologies can be used over the Internet, but are probably more suited to corporate intranets where you can ensure that the whole user-base has the right browsers installed.

ActiveX Controls Java applets
Platforms Only supported by Internet Explorer on Windows platforms. Supported by Internet Explorer and Netscape Navigator on several operating systems.

Not all browsers support all Java functionality.
Security Users can elect to disable ActiveX controls from running in their browser. Users can decline to run individual ActiveX controls. ActiveX controls can be digitally signed to verify the originator. Users can elect to disable Java applets from running in their browser. Java also has a strict security model which prevents applets from modifying or reading information from the PC they are running on.
Functionality Can access the full Windows API - so an ActiveX control can potentially carry out any function any other program or application running on a PC. Quite sophisticated GUI applications can be built with Java; however, the security model places limits on what any Java applet can do.

Form Designer enables you to add ActiveX controls and Java applets to your page in the same way as HTML controls. You can also set properties on ActiveX controls and Java applets through the Form Designer Property Editor.

Tip: If you experience problems when you try to add Java applets to a form, try downloading the latest version of the Microsoft Java Virtual Machine supplied with Internet Explorer 5 from the Microsoft Service PacksWeb site.

3.4 Form Output Types

Both Form Designer and the Internet Application Wizard offer a choice of HTML formats for recording form positioning information on a page:

Cross-platform output is supported by a wider variety of browsers. Dynamic HTML offers more exact positioning, but is only supported by Internet Explorer 4.0 or later.

The Page Wizard (for Form Designer) and Internet Application Wizard enable you to choose which format you want to use when initially creating forms. But you can also switch between formats by opening an HTML page inside Form Designer, changing its Page Properties and saving it again. Click Properties on the Page menu to display the Page Properties dialog box.

Copyright © 2000 MERANT International Limited. All rights reserved.
This document and the proprietary marks and names used herein are protected by international law.

PreviousDeveloping Internet Applications Creating New ApplicationsNext