WebBroker Technology in Action
Step one is to create a Web server application that uses the WebBroker technology. Do a File | New and select the Web Server Application icon from the Object Repository. In the dialog that follows, pick a simple CGI standalone executable as your Web server application. In order to use meaningful names, save your project as WebProj1 and your Web module (unit1) as WebMod.
Once the code for your Web server project has been generated and saved, click in the left pane of the designer and add one new Web action—you need only one to illustrate this month's problem and solution. Create a single WebItemAction, set its Default property to True, and get ready to write code for its OnAction event handler.
HTML Input Forms
Web server applications usually produce dynamic HTML, but they can respond to user input as well. To make these apps responsive to user input, you need an HTML form that contains so-called input fields. The choices for input fields are limited. You can have editboxes, memo fields (a multi-line editbox), radiobuttons, checkboxes, a listbox or comboboxes, and buttons. Each of these input fields except for the listbox accepts a single value, like the text a user enters. The listbox can be multi-valued, meaning you can select more than one item in it.
Listing 1 below shows an HTML form that contains an editbox, multivalued listbox, and two buttons (Note that METHOD=POST could also have been METHOD=GET):
<HTML>
<BODY>
<FORM ACTION="http://192.168.92.201/cgi-bin/WebProj1.exe"
METHOD="POST">
Name:
<INPUT TYPE="edit" NAME="Name" SIZE="16">
<P>
Delphi Version:
<SELECT NAME="Delphi" MULTIPLE>
<OPTION VALUE="D1"> Delphi 1
<OPTION VALUE="D2"> Delphi 2
<OPTION VALUE="D3"> Delphi 3
<OPTION VALUE="D4"> Delphi 4
<OPTION VALUE="D5"> Delphi 5
<OPTION VALUE="D6"> Delphi 6
</SELECT>
<P>
<INPUT TYPE="RESET" VALUE="Reset Query">
<INPUT TYPE="SUBMIT" VALUE="Submit">
</FORM>
</BODY>
</HTML>
Listing 1. HTML Input Form
Figure 1 shows the HTML form as seen inside Netscape Communicator 4.7. A similar form will be obtained inside Microsoft Internet Explorer.
FIGURE 1: Our HTML form as seen inside Netscape Communicator 4.7.