Forms are the means by which users may input information into a web page. If you've shopped or surfed on the Web at all, you've experienced forms in great variety.
Have you ever typed keywords into a search field to find web pages on AltaVista, or typed keywords into a search field to find books at Amazon.com? Those are forms! Have you purchased anything on-line, or requested information from a website? You certainly must have used a form to do so!
If you still don't know what a form looks like, I've created a simple survey as a form example.
If you clicked the Submit button in the above example, you may have noticed that clicking the Submit button did not actually accomplish anything. HTML forms are helpless without some sort of script, whether CGI/Perl or JavaScript, processing them in some manner.
Again, HTML forms are helpless without some sort of script, they can do NOTHING by themselves. Without a script, HTML forms are little more than a collection of radio buttons, text input fields, checkboxes, submit buttons, pulldown menus, scroll boxes, and other inputs, all of which do NOTHING NOTHING NOTHING.
So what will my answer be regarding form-based pulldown menus and navigation later on in this module? The form-based pulldown menus do NOTHING without a script! What will my answer be regarding submitting form information to someone as an email? The form can do NOTHING without a script!
So, now that you know that HTML forms do NOTHING without a script, that they are essentially inert on their own, we may proceed. (Can you tell that my students have some problems with this idea in my live classes at the MSP?)
There are two main types of scripts that HTML forms get processed by: CGI/Perl scripts, and JavaScript scripts. Although there is some overlap in capabilities, CGI/Perl scripts are usually used for processing form information and writing it to a database or sending it via email to someone, while JavaScript scripts are usually used for calculations (like mortgage calculations, interest calculations, etc) or browser-specific activities (like changing page locations, etc). The rule of thumb is that, if the form information needs to be in any way stored permanently in a database, communicated to a database, remembered for any length of time, or sent or communicated to the outside world, a CGI/Perl script will probably be needed; if the form information is to be used for something temporary, like a calculation or a special browser navigation function, a JavaScript script will usually be used.
This distinction is breaking down as technologies advance, of course: JavaScript and Flash in combination, for instance, can be used in combination with CGI/Perl scripts and databases, and DOM specifications are being designed which will allow JavaScript scripts to one day communicate with databases directly. Still, the rule can still be generally stated that CGI scripts are required when something must be communicated to the outside world and remembered, whereas JavaScript scripts may be used when something is transient or temporary.
In this module, we will be learning how to create the HTML portion of forms only. I will discuss CGI and JavaScript scripts in a general way, as they relate to the HTML part of forms. I will not be instructing you in real world forms processing, however, as it is beyond the scope of this class and requires a functioning knowledge of Perl and/or JavaScript.
Copyright © 2001 Michael Masumoto. All Rights Reserved.