Click to See Complete Forum and Search --> : Validating Fields from a HTML form using ASP before writing form data to a database


madman070578
03-02-2006, 04:57 PM
Can anyone give me any guidelines on validating data in a HTML form?

I need to validate that the fields are not empty, that certain fields only contain numbers, cetrtain fields only contain letters, and that one field only contains a date value.

I want to do this in ASP befor the information from the form is used to create an SQL statment which is going to be used to insert the data into an access database.

Bullschmidt
03-06-2006, 09:32 PM
Here are some interesting server-side validation links:

Server-Side Form Validation by Dianna Leech
http://www.4guysfromrolla.com/webtech/120199-1.shtml

An Email Validation Routine by Joćo Vieira
http://www.4guysfromrolla.com/webtech/041199-1.shtml
Somewhat shorter.

An Email Validation Script by Ben Durbin
http://www.4guysfromrolla.com/webtech/051999-1.shtml
Longer.

Form Handler: Some light form validation and error notification.
http://www.asp101.com/samples/form_handler.asp
Uses function to loop thru all fields in a form.

And here are some interesting client-side validation links:

Javascript Field Validations -- Client Side Scripting by Nannette Thacker
http://www.shiningstar.net/articles/articles/javascript/javascriptvalidations.asp?ID=AW

Form Validation Using Javascript
http://www.4guysfromrolla.com/webtech/091998-1.shtml
Good tips such as saving JavaScript functions in a file called DataValidation.js and including this in pages that need this.
JavaScript functions.

WebDaily: Your daily source for Web Technology Tips and Tricks!
http://www.4guysfromrolla.com/webtech/102798-1.shtml
Just checks if fields filled in.