Validating Forms in JavaScript


CGI is not a language. CGI is a standard which allows programs in any language to function correctly within a web server. CGI programs can be written in any language. C and Visual Basic are often used. Perl is a particularly powerful scripting language and is very usable as a CGI scripting tool.

Forms are usually handled by CGI scripts. CGI scripts run on the web server. Type in the form and press the button. The form is then sent to the CGI script for processing and a result is sent back. The disadvantage of CGI is that all processing is executed on the web server. This takes time which the web server could be using to service other calling machines. CGI is often used for form validation. Any errors await validation and response from the web server. JavaScript can validate in the browser, prompt and focus to the appropriate point on the user's screen without any web server interaction. JavaScript is thus speeds up the validation of forms.