Often we are asked "Which is better to use for form field validation, Javascript or CGI. Here is our imput on the two most popular scripting ways to validate your forms:
JavaScript and CGI script!
Pros and Cons of Using JavaScript for Validating Forms
Pros •Using JavaScript you don't use any server processor time. All the processing is done on the client computer.
•It often appears to work faster than the CGI validation.
•Since the form page has not changed, it is easy for the reader to fix the errors.
Cons •JavaScript only works on browsers that have it enabled. If the JavaScript is disabled, your error checking doesn't get done. • It appears easier for would be spammers to circumvent the JavaScript validation and recently has been included as a disabeling feature in spamming tools.
Pros and Cons of Using CGI for Validating Forms
Pros •Using a CGI to validate ensures that every time the form is submitted, the validation will run.
Cons •CGI puts more load on the Web server, and every function that is included in the CGI is one more task for the server. •CGI can be slow to run. •If there is an error, the customer has to either go back to the first page of the form, or the CGI needs another function to rewrite the form page.
The best way to handle this delima is to have the majority of the error checking done with JavaScript on the form page. That way, it is fast and easy for the readers. Then when the page is submitted you can use CGI to recheck the most vital elements, or wash ones of certain character length from the form, maybe with more scrutiny.
1 comment, (840 reads) All Articles by, GentleGiant
It is not always possible to combine. But judging by your looks better comparison JavaScript for Validating Forms. At least for my needs. Generally this your lokonichnosti big plus. The maximum useful information with a minimum amount of characters. Best regards, BrNb