954,597 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Simple JavavScript needs email validation

I made a simple javascript code but I am having problems validating the email. I am simply lost on how to do this. Can anyone help me on this?

:rolleyes:

realtureal
Newbie Poster
5 posts since Jan 2005
Reputation Points: 10
Solved Threads: 0
 

I made a simple javascript code but I am having problems validating the email. I am simply lost on how to do this. Can anyone help me on this?

:rolleyes:

If anyone knows of an information form that I can use that has validation for email, that would be helpful also.

On this form I need name, company name, email fax, tel, country, state and questions. The only thing that I need is to make sure they done leave the email blank, a pop up to remind them to fill in their email.

Any help is appreciated, thanks

realtureal
Newbie Poster
5 posts since Jan 2005
Reputation Points: 10
Solved Threads: 0
 

Post The Code, And I can help

Comatose
Taboo Programmer
Team Colleague
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
 

Thanks, Here it is I think this is the right way to post it


Name:

Your Email:

State:

Country:

Comments:

realtureal
Newbie Poster
5 posts since Jan 2005
Reputation Points: 10
Solved Threads: 0
 

http://www.aftermath.net/~coma/ex.html

Go There, Right Click on the page, and view source. That will give you all the code to do the javascript for validating the email (making sure the box is not empty, and it has an @ sign, etc). It also validates all the other fields, EXCEPT for the comments box... but you can just remove those if's and it will still work fine.

Comatose
Taboo Programmer
Team Colleague
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
 

Thank you very much. My knowledge is real limited on forms. the previous form went through a third party to convert it into a email. I do not have the CGI option on my site. (to my knowledge) Do I activate this? Also can it be directed via a third party CGI hosting service? the one I build the form on was trelix and I still continued to use that link on this Form. Am I making any sense or do i need to contact my hosting company to set up properly? Sorry for my lack of knowledge.

Again I do thank you for the Script

realtureal
Newbie Poster
5 posts since Jan 2005
Reputation Points: 10
Solved Threads: 0
 

However The Form i set up to set it up as email is the way to do it.... the thing is this: the form name (where it says MUST be in there for the javascript to work correctly. The thing is, it needs an ACTION so it knows who or what to contact with the information in the Form. Action should point to your 3rd party (most likely)

Comatose
Taboo Programmer
Team Colleague
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
 

Thanks Again. I am understanding that third party mean a CGI hosting service? Or can third party mean my website? If it can be directed to my web site, then I need to have my CGI option activated. AM I CORRECT in understanding this?

Note: you are listed as a Junior techie and I am listed as a Junior techie....However your knowledge is far greater then mine, so you should be promoted or I should be Demoted. ;) You help is greatly appreciated, thanks

realtureal
Newbie Poster
5 posts since Jan 2005
Reputation Points: 10
Solved Threads: 0
 

Ok,

My question to you is this: when they click "submit" what is supposed to happen?


note: Thanks.

Comatose
Taboo Programmer
Team Colleague
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
 

When They click "submit" the page is supposed to pass that information to another program. That program can be a CGI, it can be an ASP file, it can even be another web page. What You need to know, is to who or what that information is going to go to? Is it going to be sent as an e-mail to someone? If so, how is it going to get to him?

Comatose
Taboo Programmer
Team Colleague
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
 

Here is a tutorial that shows you how to validate foms using JavaScript. Just cut-and-paste the code and follow the instructions.

Form Validation using JavaScript

This includes a routine to validate e-mail addresses.

When a user clicks the Submit button, the JavaScript routine will validate the input before it gets sent to your e-mail handler or other script that will process the data.

Keep in mind that JavaScript is not a reliable way to do this if you need to assure that bogus information is not submitted. It is easy to turn off JavaScript in a browser and bypass any JavaScript validations.

Server side validation is an important second step to filter important data. That will require ASP, PHP, Perl or some other server-side language.

TopDogger
Junior Poster in Training
87 posts since Aug 2005
Reputation Points: 15
Solved Threads: 5
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You