Submit Forms Conditionally using JavaScript

In the long-gone days of the early Internet, having a form on the website was tantamount to dabbling with "cutting-edge" technologies. Intricate Perl scripts and esoteric CGI scripts were required to process those forms and people used to suffer bouts of cold sweat whenever there manifested a need to use web forms.

To create a form-handling script used to be in the realms of MCAs and computer engineers. No longer is it so. The Internet these days is replete with all sorts of form handling scripts, and wherever you choose to host your website, or for that matter even a web page, you can easily deploy a form handling script and start interacting with your visitors.

As the level of interaction goes complex, you require more complicated scripts. One way is to write a single script containing hundreds of lines of code. The action script (that comes within <form action="scriptname.php">) encompasses numerous if-then-else conditions, and even within these conditions, there could be zillions of nested if-then-else conditions. After a certain time it becomes a Herculean task to maintain such a form handling script and unless you are an avid documenter, you'll lose the track in no time.

Continue Reading

No comments: