Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Email Form Validation

Status
Not open for further replies.

whoknows361

Technical User
Sep 22, 2005
228
US
Hello all - been awhile.

I have searched this forum, but have not found a suitable answer to my needs.. hope you can help.

I have the following text fields in a form:
form.Sname.
form.Semail
form.Sphone
form.Salt
form.Smodel
form.Sserial
form.Sdescription

i want to add validation in the following:
for Sname, Smodel, Sserial, & Sdescription I want to ensure that the fields are not null.

For Sphone & Salt, I want to ensure that they are a phone number.
For Semail, I want to ensure that this is an email address.

If there is an erroneous entry, then I have a dynamic tb set up called "error_box"..

What would this code look like? I have seen many examples, but they don't seem to work when I try them, or are not specific to my usage.
I appreciate all help provided.

J.
 
To check if the field is empty you can check [tt]TextField.text.length[/tt] is not [tt]0[/tt]; however this won't check against " " (empty strings).

Email address & phone numbers are checked usually using ReqExp. ReqExp will solve the problem above too. But it is only available for AS3.

If you are using AS1/2 you can either check them using RegExp with client side Javascript or at the server side (PHP etc).

Kenneth Kawamoto
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top