Tutorial 13: Giving Form to Forms - HTML with Style | 13
The first implementation of forms in HTML was through the ISINDEX element. Although almost all browsers in use today support this element, it is deprecated in HTML 4.0 and generally not very versatile or useful. In other words, it works, but don't use it.
- The ISINDEX element is a block element, but for compatibility reasons it can also be placed in the HEAD element. If this is done, it is rendered at the top of the page.
- This is an empty element.
- Empty element; start-tag is required, end-tag is forbidden.
- prompt (text)
- A prompt to display to the user when the element is rendered.
- Identifier and classification attributes
- Language information attributes
- Title attribute
- Inline style information attribute
The ISINDEX element offers a prompt (the default is usually something bland and boring like "This is a searchable index. Enter search keywords:") for the user to enter some text in. When the user presses Return or the text is submitted in some other way (this depends on the user agent; currently, all known user agents require you to press Return), a question mark (?) and the text that the user typed in is appended to the document's URI. Note that it is appended to the full document URI and not the base URI. In its simplest incarnation the ISINDEX element is used alone:
This just creates a default text box. If you enter some text and press Return, you can see by looking at your browser's current location that the browser loads the current URI with the text appended. Since this page does not do anything special with this text, you just get the page again.
Try entering your last name followed by a comma, a space, and then your first name, and look at the URI that is loaded by your browser. You'll notice that the comma has been replaced by %2C and the space by +. This is called URL-encoding, and I'll explain it more in the section on Form Encoding.
As I noted above, this page does nothing with the text you submit, as it would do nothing with more complex form data such as we will examine later on. This is the part I won't tell you about, because it has nothing to do with HTML. What you need is a program that runs on your Web server and handles this text, and does something useful with the data, like searching the telephone directory and returning any matches (It could do something not useful at all too. Usefullness is not strictly required by the specification. That was more of my idea. Neat, huh?). How you are going to do this depends on your server, and various technologies like CGI, ASP and others that don't even have a three-letter acronym can help you do this. The links above lead you to the appropriate links sections in Webreference.com. You can have a peek after you're done with the tutorial. You could look now, but I won't be very happy about it.
There is a bug in Navigator and Explorer when it comes to handling the ISINDEX element. When the document contains a BASE element specifying the base URI explicitly, the browser uses that URI for the form submission instead of the current directory. No way around this is currently known, so it's best to avoid the combination, and even better, use the FORM element instead (see later).
As I said before, the ISINDEX element is deprecated and, as you have seen, not very powerful. In general, you should never use it, as you can mimic its effects using the FORM element, which we will look at next. I just mention it here for historic purposes.
Produced by Stephanos Piperoglou
Created: May 28, 1998
Revised: February 25, 1999