Databases - Delphi WebServer - Data Entry Form

These examples use basic html form commands and work with a TPageProducer.

On this page, there are many references to a Delphi web server. You should interpret that to mean either an *.exe or an *.dll file.

Basic structure | Calling Actions | Different Browser Types | Automatic Submission
Stopping History Entries | Locating items on the form | Buttons | Selecting a record with an html combobox


Basic form structure

This defines a basic form with a single data entry field and a button. However, when a web server displays a form, and the response calls the same server, then the Action should point to just the PretendDirectory.


Calling Actions - Pretend directory structure

Delphi web servers can support several addressable Actions. Using the following syntax Delphi automatically calls the TWebActionItem who's PathInfo property matches the PretendDirectory.

If the PretendDirectory is omitted, then the PathInfo property of the associated ActionItem should be empty; however, if the ActionItem's Producer property has a value, then the PathInfo should be a single forward slash (/). (In that case, a null value is not allowed.)

As long as the Producer property is blank the PathInfo property can be blank. However, once the Producer property has a value, use a single forward slash (/) if you don't want an explicit pretend directory.

The way an html page links to a Delphi web server depends on where the link is. In both of these examples, the html is generated by the server. When a reference is in an anchor link, the name of the server must be included.

However, in a form, the Action should point to just the PretendDirectory. With forms that ARE NOT generated by a server, then the full server name must be included.


Different Browser Types

One of the biggest pains in doing this is accounting for different browser types. This code fragment was generated by IIS for an ASP.Net page.


Automatic Submission

When using a barcode reader as a keyboard wedge (the software pretends that a user is typing the scanned value), I want the web server called each time the barcode is read. This is one way to accomplish that. This code calls a function each time the data changes __doPostBack is a function created by IIS for ASP.Net.


Stopping History Entries

When a single web page is called over and over, each call is placed in the browser's history list. There are many times that this is acceptable, and others where it is not.

According to - irt.org | Knowledge Base | JavaScript | History | Q244 (dated 2-28-05)

You cannot tell the browser to not store the URL in the history.
References:


Locating items on the form

In most applications, you can place a data entry field or button anywhere you want. Standard html does not provide this capability.

Traditionally, users have used tables and clear *.gif files to fake it. Unfortunately, the W3C Web Accessibility Initiative forbids this method. (Useful formatting is not fair to disabled users that can not understand the formatting.)

These examples (produced via an ASP.NET page) show how to use style information inside individual elements to explicitly control position.


Buttons

This button calls the specified web page

This button is used to return to the main page.

I hate using the double dots (I don't like what it does to the web server stats), but I don't know what else to do. To simplify the Exit button (required on all pages), I use substitution in the web pages is replaced via

This are 2 alternatives

and another


Selecting a record with an html combobox

This is how to use javascript to select a record with a select list (combobox). Normally, forms are submitted via a button ... this is another way - when a new value is selected, the form submits. I searched the web to find this code - what I found DID NOT WORK (but it was close). There are 2 apparent problems Specifically, these combinations fail (nothing happens) this combinations produce Error on page errors and these combinations work The code to determine which browser is used - function submitform() - is from an ASP.NET page.

According to the HTML 4.0 standard

[The name] attribute has been included for backwards compatibility. Applications should use the id attribute to identify elements.

I tested this using using IE 6.0 - apparently, IE 6 is not backward compatible.

(In the examples above, a trailing semicolon has no effect)

References


Author: Robert Clemenzi - clemenzi@cpcug.org
URL: http:// cpcug.org / user / clemenzi / technical / Databases / Delphi / WebServers / WebServer_DataEntryForm.html