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:

Recommended Answers

All 10 Replies

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

Post The Code, And I can help

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

<font size="3" color="#000000" face="Arial,Helvetica,sans-serif"><input type="hidden" name="tlx_SortOrder" value="Name,Your Email,State,Country,Comments">
<input type="hidden" name="tlx_FormIndex" value="2">
<input type="hidden" name="tlx_OKMessage" value="Thank you for your request for information. We will respond back to you in a timely manner. If you forgot or didn't enter a vailid email address please hit the arrow to resend with a vaild email address. we can't contact you if you don't give us a valid return address. Your email address will never be placed on any list or traded.">
<input type="hidden" name="tlx_SendMode" value="1">
<input type="hidden" name="tlx_Subject" value="Email form Turf website">
<input type="hidden" name="tlx_EmailTo" value="uas@uas-cropmaster.com">
</font>
<table cellpadding="0" cellspacing="1" border="0" align="center" width="454">
<tr>
<td align="left"> Name:<br>
<input type="text" name="FirstName" size="50" maxlength="100">
</td>
</tr>
<tr>
<td align="left" height="51">Your Email:<br>
<input type="text" name="Email" size="50" maxlength="100">
</td>
</tr>
<tr>
<td align="left">State:<br>
<input type="text" name="State" size="50" maxlength="100">
</td>
</tr>
<tr>
<td align="left">Country:<br>
<input type="text" name="country" size="50" maxlength="100">
</td>
</tr>
<tr>
<td align="left">Comments:<br>
<textarea name="Comments" rows="5" cols="100"></textarea>
</td>
</tr>
<tr>
<td align="right">
<input type="reset" name="reset">
<input type="submit" value="Send" name="tlx_send">
</td>
</tr>
</table>

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.

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

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 <FORM NAME="datafrm"> 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)

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

Ok,

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


note: Thanks.

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?

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.